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

is_system_path: return False if path is None #28403

Merged
merged 2 commits into from Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/spack/spack/test/util/environment.py
Expand Up @@ -22,6 +22,8 @@ def prepare_environment_for_tests():
def test_is_system_path():
assert(envutil.is_system_path('/usr/bin'))
assert(not envutil.is_system_path('/nonsense_path/bin'))
assert(not envutil.is_system_path(''))
assert(not envutil.is_system_path(None))


test_paths = ['/usr/bin',
Expand Down
2 changes: 1 addition & 1 deletion lib/spack/spack/util/environment.py
Expand Up @@ -59,7 +59,7 @@ def is_system_path(path):
Returns:
True or False
"""
return os.path.normpath(path) in system_dirs
return path and os.path.normpath(path) in system_dirs


def filter_system_paths(paths):
Expand Down