예제 #1
0
 def test_set(self):
     env = EnvironmentModifications()
     env.set('A', 'dummy value')
     env.set('B', 3)
     env.apply_modifications()
     self.assertEqual('dummy value', os.environ['A'])
     self.assertEqual(str(3), os.environ['B'])
예제 #2
0
 def test_extra_arguments(self):
     env = EnvironmentModifications()
     env.set('A', 'dummy value', who='Pkg1')
     for x in env:
         assert 'who' in x.args
     env.apply_modifications()
     self.assertEqual('dummy value', os.environ['A'])
예제 #3
0
파일: environment.py 프로젝트: d-tk/spack
 def test_extra_arguments(self):
     env = EnvironmentModifications()
     env.set('A', 'dummy value', who='Pkg1')
     for x in env:
         assert 'who' in x.args
     env.apply_modifications()
     self.assertEqual('dummy value', os.environ['A'])
예제 #4
0
파일: environment.py 프로젝트: d-tk/spack
 def test_set(self):
     env = EnvironmentModifications()
     env.set('A', 'dummy value')
     env.set('B', 3)
     env.apply_modifications()
     self.assertEqual('dummy value', os.environ['A'])
     self.assertEqual(str(3), os.environ['B'])
예제 #5
0
def clean_environment():
    # Stuff in here sanitizes the build environment to eliminate
    # anything the user has set that may interfere. We apply it immediately
    # unlike the other functions so it doesn't overwrite what the modules load.
    env = EnvironmentModifications()

    # Remove these vars from the environment during build because they
    # can affect how some packages find libraries.  We want to make
    # sure that builds never pull in unintended external dependencies.
    env.unset('LD_LIBRARY_PATH')
    env.unset('LIBRARY_PATH')
    env.unset('CPATH')
    env.unset('LD_RUN_PATH')
    env.unset('DYLD_LIBRARY_PATH')

    build_lang = spack.config.get('config:build_language')
    if build_lang:
        # Override language-related variables. This can be used to force
        # English compiler messages etc., which allows parse_log_events to
        # show useful matches.
        env.set('LC_ALL', build_lang)

    # Remove any macports installs from the PATH.  The macports ld can
    # cause conflicts with the built-in linker on el capitan.  Solves
    # assembler issues, e.g.:
    #    suffix or operands invalid for `movq'"
    path = get_path('PATH')
    for p in path:
        if '/macports/' in p:
            env.remove_path('PATH', p)

    env.apply_modifications()
예제 #6
0
def clean_environment():
    # Stuff in here sanitizes the build environment to eliminate
    # anything the user has set that may interfere. We apply it immediately
    # unlike the other functions so it doesn't overwrite what the modules load.
    env = EnvironmentModifications()

    # Remove these vars from the environment during build because they
    # can affect how some packages find libraries.  We want to make
    # sure that builds never pull in unintended external dependencies.
    env.unset('LD_LIBRARY_PATH')
    env.unset('LIBRARY_PATH')
    env.unset('CPATH')
    env.unset('LD_RUN_PATH')
    env.unset('DYLD_LIBRARY_PATH')

    build_lang = spack.config.get('config:build_language')
    if build_lang:
        # Override language-related variables. This can be used to force
        # English compiler messages etc., which allows parse_log_events to
        # show useful matches.
        env.set('LC_ALL', build_lang)

    # Remove any macports installs from the PATH.  The macports ld can
    # cause conflicts with the built-in linker on el capitan.  Solves
    # assembler issues, e.g.:
    #    suffix or operands invalid for `movq'"
    path = get_path('PATH')
    for p in path:
        if '/macports/' in p:
            env.remove_path('PATH', p)

    env.apply_modifications()
예제 #7
0
 def test_extend(self):
     env = EnvironmentModifications()
     env.set('A', 'dummy value')
     env.set('B', 3)
     copy_construct = EnvironmentModifications(env)
     self.assertEqual(len(copy_construct), 2)
     for x, y in zip(env, copy_construct):
         assert x is y
예제 #8
0
파일: environment.py 프로젝트: d-tk/spack
 def test_extend(self):
     env = EnvironmentModifications()
     env.set('A', 'dummy value')
     env.set('B', 3)
     copy_construct = EnvironmentModifications(env)
     self.assertEqual(len(copy_construct), 2)
     for x, y in zip(env, copy_construct):
         assert x is y