-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Do not build Programs/_freeze_importlib when cross-compiling #71828
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
Comments
Based on http://bugs.python.org/issue27490 and http://bugs.python.org/msg271495, here is a patch that makes sure Programs/_freeze_importlib is only built when not cross-compiling. |
Here is another possible option. It is still a bit of a hack, because the configure script inserts comments into the makefile, but this is already done e.g. with @EXPORT_MACOSX_DEPLOYMENT_TARGET@. The advantage is we get to keep the filenames of the dependencies in the makefile, so it should be easier to read and maintain. And we get to eliminate the $(cross_compiling) check as well. In native compiling mode, everything should be as normal. When cross-compiling, the rules for regenerating files should read like Python/importlib.h: # $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib Since the Python/importlib.h should already exist, the rule in this form (dependencies commented out) won’t be run, and Make won’t need to build Programs/_freeze_importlib either. |
Nice. FWIW cross-compilation for Android works fine with comment-out-regen.patch.
They do read like this. |
+1 on comment-out-regen.patch, makes things much cleaner and removes the shell "if" in the rule body. Just a small bikeshed issue: Instead of COMMENT_REGEN, maybe call it "CROSS_COMPILE_COMMENT" or "GENERATED_COMMENT" or "COMMENT_IF_CROSS" or somesuch? This way, might be easier to read/understand the makefile rules ("COMMENT_IF_CROSS" -> "a comment character will be inserted here if cross-compiling")? |
Thanks for the feedback. I did wonder about the name. Perhaps I will go with GENERATED_COMMENT: GENERATED_COMMENT='#' Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib |
New changeset bc677cb34889 by Martin Panter in branch '3.5': New changeset fc034d3607a8 by Martin Panter in branch 'default': |
New changeset e3757f3e1848 by Martin Panter in branch '2.7': |
_freeze_import is only in Python 3, but I backported my final change because it is more general and also affects pgen. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: