Skip to content

Commit

Permalink
Use meson guidance for disambiguating symlink versus wrap subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Oct 4, 2024
1 parent 30914ec commit 9eb20d2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions python/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ def copy_or_generate_nanoarrow_c():
subproj_dir = this_dir / "subprojects"

# prefer a symlinked directory if it exists
if (subproj_dir / "arrow-nanoarrow").exists():
source_dir = subproj_dir / "arrow-nanoarrow"
else: # fall back to wrap-downloaded project, which may have a suffix
if (subproj_dir / "arrow-nanoarrow-dev").exists():
source_dir = subproj_dir / "arrow-nanoarrow-dev"
else: # fall back to wrap-downloaded project
arrow_dirs = list(subproj_dir.glob("arrow-nanoarrow-*/"))
if (num_dir := len(arrow_dirs)) != 1:
raise ValueError(
Expand Down
10 changes: 8 additions & 2 deletions python/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ project(
'warning_level=2',
'cpp_std=c++17',
'default_library=static',
'arrow-nanoarrow:ipc=true', # https://github.com/mesonbuild/meson/issues/6728
'arrow-nanoarrow:device=true', # https://github.com/mesonbuild/meson/issues/6728
# the duplication of arrow-nanoarrow here is a result of a meson bug
# https://github.com/mesonbuild/meson/issues/13746#issuecomment-2392510954
# We also need to set these options at the project default_option level
# due to https://github.com/mesonbuild/meson/issues/6728
'arrow-nanoarrow-dev:ipc=true',
'arrow-nanoarrow-dev:device=true',
'arrow-nanoarrow:ipc=true',
'arrow-nanoarrow:device=true',
],
)

Expand Down
10 changes: 9 additions & 1 deletion python/src/nanoarrow/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@
# specific language governing permissions and limitations
# under the License.

nanoarrow_proj = subproject('arrow-nanoarrow')
# Try to resolve the symlink to a subproject first and fall back
# to the wrap entry if that is unsuccessful. Ideally Meson would
# take care of this for us, but there is a bug upstream
# https://github.com/mesonbuild/meson/issues/13746#issuecomment-2392510954
nanoarrow_proj = subproject('arrow-nanoarrow-dev', required: false)
if not nanoarrow_proj.found()
nanoarrow_proj = subproject('arrow-nanoarrow')
endif

nanoarrow_dep = nanoarrow_proj.get_variable('nanoarrow_dep')
nanoarrow_ipc_dep = nanoarrow_proj.get_variable('nanoarrow_ipc_dep')
nanoarrow_device_dep = nanoarrow_proj.get_variable('nanoarrow_device_dep')
Expand Down
1 change: 0 additions & 1 deletion python/subprojects/arrow-nanoarrow

This file was deleted.

0 comments on commit 9eb20d2

Please sign in to comment.