-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix an issue if user passes a relative path to Python #26799
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
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 |
|---|---|---|
|
|
@@ -74,6 +74,20 @@ def normalize_config_settings(): | |
| PORTS = os.path.join(CACHE, 'ports') | ||
|
|
||
|
|
||
| def normalize_relative_python_path(): | ||
| # User may have specified the EMSDK_PYTHON environment variable to point to | ||
| # the Python interpreter, e.g. | ||
| # | ||
| # EMSDK_PYTHON=../../path/to/python emcc test/hello_world.c | ||
| # | ||
| # As part of its operation, emcc may spawn sub-emcc tasks when building | ||
| # libraries to cache. These sub-emcc tasks will run in a different CWD, so | ||
| # reinitialize EMSDK_PYTHON here so that sub-tool spawns will use the same | ||
| # Python interpreter as the parent. | ||
| if os.environ.get('EMSDK_PYTHON'): | ||
| os.environ['EMSDK_PYTHON'] = sys.executable | ||
|
|
||
|
|
||
| def set_config_from_tool_location(config_key, tool_binary, f): | ||
| val = globals()[config_key] | ||
| if val is None: | ||
|
|
@@ -168,6 +182,7 @@ def read_config(): | |
| set_config_from_tool_location('BINARYEN_ROOT', 'wasm-opt', lambda x: os.path.dirname(os.path.dirname(x))) | ||
|
|
||
| normalize_config_settings() | ||
| normalize_relative_python_path() | ||
|
Collaborator
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. This kind of has the wrong name now.
Collaborator
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. Hmm, yeah, not sure what's a better name here. Though I'll leave it if you want to address further.
Collaborator
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. Yeah no worries, feel free to land |
||
|
|
||
|
|
||
| def generate_config(path): | ||
|
|
||
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.
Nice! That seems much better.
I also think we could probably localize this to
run_build_commandsinsystem_libs.py(since that is the only place its really needed.But if you want to land as-is and can do some followups.