Skip to content
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

[Bazel] Unset PYTHONSAFEPATH in env.bat and env.sh. #1423

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions bazel/emscripten_toolchain/env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
set ROOT_DIR=%CD%
set EMSCRIPTEN=%ROOT_DIR%\%EM_BIN_PATH%\emscripten
set EM_CONFIG=%ROOT_DIR%\%EM_CONFIG_PATH%

allsey87 marked this conversation as resolved.
Show resolved Hide resolved
:: Ensure PYTHONSAFEPATH is not set so that modules in the same
:: directory as emcc.py and emar.py etc. can be found via sys.path
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe mention that this is needed because py_binary sets this?

Alternatively, perhaps there is a more canonical way to express this in a py_binary? i.e. perhaps there is an explicit way to add the emscripten root the PYTHONPATH?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

py_binary is the more idiomatic solution. Although I am blocked on this at the moment due to a bug in python_rules.

set PYTHONSAFEPATH=
4 changes: 4 additions & 0 deletions bazel/emscripten_toolchain/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
export ROOT_DIR=${EXT_BUILD_ROOT:-$(pwd -P)}
export EMSCRIPTEN=$ROOT_DIR/$EM_BIN_PATH/emscripten
export EM_CONFIG=$ROOT_DIR/$EM_CONFIG_PATH

# Ensure PYTHONSAFEPATH is not set so that modules in the same
# directory as emcc.py and emar.py etc. can be found via sys.path
unset PYTHONSAFEPATH