6363
6464import llnl .util .tty as tty
6565from llnl .util .tty .color import colorize
66- from llnl .util .filesystem import join_path , mkdirp , install , install_tree
66+ from llnl .util .filesystem import mkdirp , install , install_tree
6767
68- import spack
68+ import spack .main
69+ import spack .paths
6970import spack .store
7071from spack .environment import EnvironmentModifications , validate
7172from spack .util .environment import env_flag , filter_system_paths , get_path
@@ -138,21 +139,21 @@ def set_compiler_environment_variables(pkg, env):
138139 # and return it
139140 # TODO : add additional kwargs for better diagnostics, like requestor,
140141 # ttyout, ttyerr, etc.
141- link_dir = spack .build_env_path
142+ link_dir = spack .paths . build_env_path
142143
143144 # Set SPACK compiler variables so that our wrapper knows what to call
144145 if compiler .cc :
145146 env .set ('SPACK_CC' , compiler .cc )
146- env .set ('CC' , join_path (link_dir , compiler .link_paths ['cc' ]))
147+ env .set ('CC' , os . path . join (link_dir , compiler .link_paths ['cc' ]))
147148 if compiler .cxx :
148149 env .set ('SPACK_CXX' , compiler .cxx )
149- env .set ('CXX' , join_path (link_dir , compiler .link_paths ['cxx' ]))
150+ env .set ('CXX' , os . path . join (link_dir , compiler .link_paths ['cxx' ]))
150151 if compiler .f77 :
151152 env .set ('SPACK_F77' , compiler .f77 )
152- env .set ('F77' , join_path (link_dir , compiler .link_paths ['f77' ]))
153+ env .set ('F77' , os . path . join (link_dir , compiler .link_paths ['f77' ]))
153154 if compiler .fc :
154155 env .set ('SPACK_FC' , compiler .fc )
155- env .set ('FC' , join_path (link_dir , compiler .link_paths ['fc' ]))
156+ env .set ('FC' , os . path . join (link_dir , compiler .link_paths ['fc' ]))
156157
157158 # Set SPACK compiler rpath flags so that our wrapper knows what to use
158159 env .set ('SPACK_CC_RPATH_ARG' , compiler .cc_rpath_arg )
@@ -302,20 +303,21 @@ def set_build_environment_variables(pkg, env, dirty):
302303 env .prepend_path ('PATH' , bin_dir )
303304
304305 # Add spack build environment path with compiler wrappers first in
305- # the path. We add both spack.env_path , which includes default
306+ # the path. We add the compiler wrapper path , which includes default
306307 # wrappers (cc, c++, f77, f90), AND a subdirectory containing
307308 # compiler-specific symlinks. The latter ensures that builds that
308- # are sensitive to the *name* of the compiler see the right name
309- # when we're building with the wrappers.
309+ # are sensitive to the *name* of the compiler see the right name when
310+ # we're building with the wrappers.
310311 #
311312 # Conflicts on case-insensitive systems (like "CC" and "cc") are
312313 # handled by putting one in the <build_env_path>/case-insensitive
313314 # directory. Add that to the path too.
314315 env_paths = []
315- compiler_specific = join_path (spack .build_env_path , pkg .compiler .name )
316- for item in [spack .build_env_path , compiler_specific ]:
316+ compiler_specific = os .path .join (
317+ spack .paths .build_env_path , pkg .compiler .name )
318+ for item in [spack .paths .build_env_path , compiler_specific ]:
317319 env_paths .append (item )
318- ci = join_path (item , 'case-insensitive' )
320+ ci = os . path . join (item , 'case-insensitive' )
319321 if os .path .isdir (ci ):
320322 env_paths .append (ci )
321323
@@ -328,12 +330,12 @@ def set_build_environment_variables(pkg, env, dirty):
328330 env .set (SPACK_DEBUG , 'TRUE' )
329331 env .set (SPACK_SHORT_SPEC , pkg .spec .short_spec )
330332 env .set (SPACK_DEBUG_LOG_ID , pkg .spec .format ('${PACKAGE}-${HASH:7}' ))
331- env .set (SPACK_DEBUG_LOG_DIR , spack .spack_working_dir )
333+ env .set (SPACK_DEBUG_LOG_DIR , spack .main . spack_working_dir )
332334
333335 # Add any pkgconfig directories to PKG_CONFIG_PATH
334336 for prefix in build_link_prefixes :
335337 for directory in ('lib' , 'lib64' , 'share' ):
336- pcdir = join_path (prefix , directory , 'pkgconfig' )
338+ pcdir = os . path . join (prefix , directory , 'pkgconfig' )
337339 if os .path .isdir (pcdir ):
338340 env .prepend_path ('PKG_CONFIG_PATH' , pcdir )
339341
@@ -374,11 +376,11 @@ def set_module_variables_for_package(pkg, module):
374376 m .std_cmake_args = spack .CMakePackage ._std_args (pkg )
375377
376378 # Put spack compiler paths in module scope.
377- link_dir = spack .build_env_path
378- m .spack_cc = join_path (link_dir , pkg .compiler .link_paths ['cc' ])
379- m .spack_cxx = join_path (link_dir , pkg .compiler .link_paths ['cxx' ])
380- m .spack_f77 = join_path (link_dir , pkg .compiler .link_paths ['f77' ])
381- m .spack_fc = join_path (link_dir , pkg .compiler .link_paths ['fc' ])
379+ link_dir = spack .paths . build_env_path
380+ m .spack_cc = os . path . join (link_dir , pkg .compiler .link_paths ['cc' ])
381+ m .spack_cxx = os . path . join (link_dir , pkg .compiler .link_paths ['cxx' ])
382+ m .spack_f77 = os . path . join (link_dir , pkg .compiler .link_paths ['f77' ])
383+ m .spack_fc = os . path . join (link_dir , pkg .compiler .link_paths ['fc' ])
382384
383385 # Emulate some shell commands for convenience
384386 m .pwd = os .getcwd
0 commit comments