Skip to content

Commit

Permalink
Generate dist script
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Oct 15, 2024
1 parent 105ca94 commit 9bae7f3
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
recursive-include vendor *.c *.h *.pxd
recursive-include src/nanoarrow *.pxd
recursive-include src/nanoarrow *.h
include subprojects/arrow-nanoarrow.wrap

exclude bootstrap.py
exclude generate_dist.py
exclude src/nanoarrow/*.c
recursive-exclude src/nanoarrow *.o *.so
53 changes: 53 additions & 0 deletions python/generate_dist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

import os
import pathlib
import shutil


def main():
src_dir = pathlib.Path(os.environ["MESON_SOURCE_ROOT"]).parent.resolve()
dist_dir = pathlib.Path(os.environ["MESON_DIST_ROOT"]).resolve()
subproj_dir = dist_dir / "subprojects" / "arrow-nanoarrow"

if subproj_dir.is_symlink():
subproj_dir.unlink()

subproj_dir.mkdir()
shutil.copy(src_dir / "meson.build", subproj_dir / "meson.build")
shutil.copy(src_dir / "meson.options", subproj_dir / "meson.options")

subproj_subproj_dir = subproj_dir / "subprojects"
subproj_subproj_dir.mkdir()
for f in (src_dir / "subprojects").glob("*.wrap"):
shutil.copy(f, subproj_subproj_dir / f.name)

target_src_dir = subproj_dir / "src"
shutil.copytree(src_dir / "src", target_src_dir)

# this files are only needed by bootstrap.py
shutil.copy(src_dir / "CMakeLists.txt", subproj_dir / "CMakeLists.txt")
subproj_ci_scripts_dir = subproj_dir / "ci" / "scripts"
subproj_ci_scripts_dir.mkdir(parents=True)
shutil.copy(
src_dir / "ci" / "scripts" / "bundle.py", subproj_ci_scripts_dir / "bundle.py"
)


if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions python/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ project(
)

subdir('src/nanoarrow')

meson.add_dist_script('python', meson.current_source_dir() / 'generate_dist.py')

0 comments on commit 9bae7f3

Please sign in to comment.