Skip to content

Commit

Permalink
is_system_path: return False if path is None (spack#28403)
Browse files Browse the repository at this point in the history
  • Loading branch information
tldahlgren authored and RikkiButler20 committed Feb 1, 2022
1 parent 202f279 commit cb1eaa3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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

0 comments on commit cb1eaa3

Please sign in to comment.