Skip to content

Commit

Permalink
Merge pull request #440 from blue-yonder/fix-cross-compilation-with-a…
Browse files Browse the repository at this point in the history
…rrow

Fix pyarrow detection in the cross-compilation setting
  • Loading branch information
xhochy authored Sep 27, 2024
2 parents 73adf54 + dbd110e commit a6c4b0d
Showing 1 changed file with 33 additions and 5 deletions.
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

0 comments on commit a6c4b0d

Please sign in to comment.