diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2022-01-17 07:44:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-17 08:44:10 -0700 |
commit | f238835b657922324c5c9ad201baeadda1a05b7e (patch) | |
tree | 541b756b99b21a5d15c6e84cf7a89afe7064168a /lib | |
parent | 7e3677db6f6b780049e65133793df65a49718395 (diff) | |
download | spack-f238835b657922324c5c9ad201baeadda1a05b7e.tar.gz spack-f238835b657922324c5c9ad201baeadda1a05b7e.tar.bz2 spack-f238835b657922324c5c9ad201baeadda1a05b7e.tar.xz spack-f238835b657922324c5c9ad201baeadda1a05b7e.zip |
is_system_path: return False if path is None (#28403)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/util/environment.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/util/environment.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/spack/spack/test/util/environment.py b/lib/spack/spack/test/util/environment.py index e9d3f2731e..4d0a931a56 100644 --- a/lib/spack/spack/test/util/environment.py +++ b/lib/spack/spack/test/util/environment.py @@ -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', diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py index 44abccdf04..b6c3ac359b 100644 --- a/lib/spack/spack/util/environment.py +++ b/lib/spack/spack/util/environment.py @@ -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): |