summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2022-01-17 07:44:10 -0800
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-04-14 11:08:17 +0200
commitab5c02d538fe7dac52aac6b481ea295a83371839 (patch)
treea081e5a8498f15e0b71c23f0dda0aba2665d7b25
parent1fd6fedba5e8193a040c3214c00c04792e15d9ed (diff)
downloadspack-ab5c02d538fe7dac52aac6b481ea295a83371839.tar.gz
spack-ab5c02d538fe7dac52aac6b481ea295a83371839.tar.bz2
spack-ab5c02d538fe7dac52aac6b481ea295a83371839.tar.xz
spack-ab5c02d538fe7dac52aac6b481ea295a83371839.zip
is_system_path: return False if path is None (#28403)
-rw-r--r--lib/spack/spack/test/util/environment.py2
-rw-r--r--lib/spack/spack/util/environment.py2
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 233fc0ba84..d5b9d683b7 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 f0457c27b8..e0f0cbec2f 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):