Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pyarrow detection in the cross-compilation setting #440

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,50 @@ if incdir_pyarrow == 'not-given'
[
'-c',
'''import os
import pyarrow as pa
import sysconfig
try:
incdir = os.path.relpath(pa.get_include())
incdir = os.path.relpath(sysconfig.get_path('platlib'))
except Exception:
incdir = pa.get_include()
print(incdir)
incdir = sysconfig.get_path('platlib')
print(incdir + "/pyarrow/include")
'''
],
check: true
).stdout().strip()

# We do need an absolute path to feed to `cc.find_library` below
_incdir_pyarrow_abs = run_command(py,
['-c', 'import pyarrow; print(pyarrow.get_include())'],
[
'-c',
'''import os
import sysconfig
print(os.path.abspath(sysconfig.get_path("platlib")) + "/pyarrow/include")
'''
],
check: true
).stdout().strip()
# We would rather like to use the following code, but sadly pyarrow (in contrast to numpy)
# does not name the correct directory in a cross-compilation setting.
# incdir_pyarrow = run_command(py,
# [
# '-c',
# '''import os
#import pyarrow as pa
#try:
# incdir = os.path.relpath(pa.get_include())
#except Exception:
# incdir = pa.get_include()
#print(incdir)
# '''
# ],
# check: true
# ).stdout().strip()
#
# # We do need an absolute path to feed to `cc.find_library` below
# _incdir_pyarrow_abs = run_command(py,
# ['-c', 'import pyarrow; print(pyarrow.get_include())'],
# check: true
# ).stdout().strip()
else
_incdir_pyarrow_abs = incdir_pyarrow
endif
Expand Down