summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_environment.py2
-rw-r--r--lib/spack/spack/test/flag_handlers.py12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 9fe7c1fbb7..463c4dcde7 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -346,7 +346,7 @@ def set_compiler_environment_variables(pkg, env):
handler = pkg.flag_handler.__func__
else:
handler = pkg.flag_handler.im_func
- injf, envf, bsf = handler(pkg, flag, spec.compiler_flags[flag])
+ injf, envf, bsf = handler(pkg, flag, spec.compiler_flags[flag][:])
inject_flags[flag] = injf or []
env_flags[flag] = envf or []
build_system_flags[flag] = bsf or []
diff --git a/lib/spack/spack/test/flag_handlers.py b/lib/spack/spack/test/flag_handlers.py
index d55a059769..3b871a2bc9 100644
--- a/lib/spack/spack/test/flag_handlers.py
+++ b/lib/spack/spack/test/flag_handlers.py
@@ -135,3 +135,15 @@ class TestFlagHandlers(object):
"-DCMAKE_CXX_STANDARD_LIBRARIES=-lfoo",
"-DCMAKE_Fortran_STANDARD_LIBRARIES=-lfoo",
}
+
+ def test_flag_handler_no_modify_specs(self, temp_env):
+ def test_flag_handler(self, name, flags):
+ flags.append("-foo")
+ return (flags, None, None)
+
+ s = spack.spec.Spec("cmake-client").concretized()
+ s.package.flag_handler = test_flag_handler
+ spack.build_environment.setup_package(s.package, False)
+
+ assert not s.compiler_flags["cflags"]
+ assert os.environ["SPACK_CFLAGS"] == "-foo"