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

make sure user packages are not used in sanity check of PythonBundle #3435

Merged
merged 1 commit into from
Sep 7, 2024
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
12 changes: 12 additions & 0 deletions easybuild/easyblocks/generic/pythonbundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,18 @@ def make_module_extra(self, *args, **kwargs):

return txt

def load_module(self, *args, **kwargs):
"""
Make sure that $PYTHONNOUSERSITE is defined after loading module file for this software."""

super(PythonBundle, self).load_module(*args, **kwargs)

# Don't add user site directory to sys.path (equivalent to python -s),
# to avoid that any Python packages installed in $HOME/.local/lib affect the sanity check.
# Required here to ensure that it is defined for sanity check commands of the bundle
# because the environment is reset to the initial environment right before loading the module
env.setvar('PYTHONNOUSERSITE', '1', verbose=False)

def sanity_check_step(self, *args, **kwargs):
"""Custom sanity check for bundle of Python package."""

Expand Down
Loading