-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix replacing local include paths #4136
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
Changes from all commits
9d565cb
f74736e
2051773
fd2ce2d
d2b81a0
91c5f38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -226,14 +226,19 @@ def replay_genargs_handle_dashI(arg: str, target_install_dir: str) -> str | None | |||
| The new argument, or None to delete the argument. | ||||
| """ | ||||
| assert arg.startswith("-I") | ||||
| if ( | ||||
| str(Path(arg[2:]).resolve()).startswith(sys.prefix + "/include/python") | ||||
| and "site-packages" not in arg | ||||
| ): | ||||
| return arg.replace("-I" + sys.prefix, "-I" + target_install_dir) | ||||
|
|
||||
| # Don't include any system directories | ||||
| if arg[2:].startswith("/usr"): | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, could this system directories case can be removed since it is already tackled by the Maybe there are other reasons to remove system directories than the Python include though.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure to be honest, we will have to check. Some codes in |
||||
| return None | ||||
|
|
||||
| # Replace local Python include paths with the cross compiled ones | ||||
| include_path = str(Path(arg[2:]).resolve()) | ||||
| if include_path.startswith(sys.prefix + "/include/python"): | ||||
| return arg.replace("-I" + sys.prefix, "-I" + target_install_dir) | ||||
|
|
||||
| if include_path.startswith(sys.base_prefix + "/include/python"): | ||||
| return arg.replace("-I" + sys.base_prefix, "-I" + target_install_dir) | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And another question while I am at it. In my case (and it seems in out-of-tree builds in general),
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, indeed we are setting it to an empty string in out-of-tree build.
@hoodmane is it intended? I think it is incorrect.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I just didn't know what this variable does or how to fill it, and setting it empty didn't break anything so I left it like that. Since something is breaking now it you probably know what should actually go there.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I'll update that part to set the correct target_install_dir. I think it didn't break since we append cpython include all the time. |
||||
|
|
||||
| return arg | ||||
|
|
||||
|
|
||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You removed the
site-packagescase (where there was no replacement before this PR), I am not sure whether this was useful or not ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that part is not useful, as
site-packagesdirectory is in/lib/site-packagesand not in/include/python3.11/....For header files in site-packages directories, we cover them by copying header files (e.g. numpy header files) into the virtual env directory:
pyodide/pyodide-build/pyodide_build/buildpkg.py
Lines 534 to 537 in e492392
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK makes sense, thanks!