Skip to content

BLD: Fix compiling pandas with a venv located in the src dir #53489

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

Merged
merged 1 commit into from
Jun 1, 2023
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
13 changes: 12 additions & 1 deletion pandas/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
incdir_numpy = run_command(py,
[
'-c',
'import os; os.chdir(".."); import numpy; print(numpy.get_include())'
'''
import os
import numpy as np
try:
# Check if include directory is inside the pandas dir
# e.g. a venv created inside the pandas dir
# If so, convert it to a relative path
incdir = os.path.relpath(np.get_include())
except Exception:
incdir = np.get_include()
Comment on lines +7 to +13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if you're expecting relpath to raise if the path is not a subdirectory. It doesn't:

import os

print(os.getcwd())
# /home/richard/dev
print(os.path.relpath('/home/richard/dev'))
# '.'
print(os.path.relpath('/home/richard/dev/pandas'))
# pandas
print(os.path.relpath('/home/richard'))
# ..

print(incdir)
'''
],
check: true
).stdout().strip()
Expand Down