Skip to content

Commit 65c008e

Browse files
committed
move write_spconfig into build_process (to avoid affecting current env); in this case write_spconfig doesnt have to invoke setup_package
1 parent 0ebabc1 commit 65c008e

File tree

2 files changed

+19
-32
lines changed

2 files changed

+19
-32
lines changed

lib/spack/spack/build_systems/cmake.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,6 @@ def check(self):
258258
run_after('install')(PackageBase.sanity_check_prefix)
259259

260260
def write_spconfig(self, spack_env, spconfig_fname, dirty):
261-
"""Writes the spconfig.py (CMake setup file) to a file.
262-
spack_env: Environment
263-
If installing into an environment, this is it
264-
spconfig_fname:
265-
Leaf of filename for the resulting spconfig file.
266-
dirty (bool): If True, do NOT clean the environment before
267-
building.
268-
269-
Returns:
270-
name of file written
271-
"""
272-
273-
# Execute all environment setup routines.
274-
spack.build_environment.setup_package(self, dirty)
275-
276261
fname = os.path.join(spack_env.path, spconfig_fname) \
277262
if spack_env is not None else spconfig_fname
278263

lib/spack/spack/package.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,13 @@ def try_install_from_binary_cache(self, explicit):
13231323
return True
13241324

13251325
def write_spconfig(self, spack_env, spconfig_fname, dirty):
1326-
"""Execute all environment setup routines (dummy virtual function).
1326+
"""Dump environment variable modifications to a script that can be run
1327+
to replicate the Spack build environment for this package. This must
1328+
be supported on a per-build-system basis.
1329+
1330+
This function executes inside of the build environment that is created
1331+
by Spack for the package to install in.
1332+
13271333
spack_env: Environment
13281334
If installing into an environment, this is it
13291335
spconfig_fname:
@@ -1391,6 +1397,7 @@ def do_install(self,
13911397
is_setup = (self.name in setup)
13921398
if is_setup:
13931399
keep_prefix = True
1400+
explicit = True
13941401

13951402
# For external packages the workflow is simplified, and basically
13961403
# consists in module file generation and registration in the DB
@@ -1442,21 +1449,6 @@ def do_install(self,
14421449
setup=setup,
14431450
**kwargs)
14441451

1445-
if is_setup:
1446-
explicit = True
1447-
self.stage = DIYStage(os.getcwd()) # Force build in cwd
1448-
1449-
# --- Generate spconfig.py
1450-
spconfig_fname = self.name + '-setup.py'
1451-
tty.msg(
1452-
'Generating config file {0} [{1}]'.format(
1453-
spconfig_fname, self.spec.cshort_spec))
1454-
1455-
# Calls virtual function of subclass
1456-
# (eg: CMakePackage, MakefilePackage, etc.)
1457-
spconfig_fname = self.write_spconfig(
1458-
spack_env, spconfig_fname, dirty)
1459-
14601452
tty.msg(colorize('@*{Installing} @*g{%s}' % self.name))
14611453

14621454
if kwargs.get('use_cache', True):
@@ -1510,7 +1502,17 @@ def build_process():
15101502
# the directory is created.
15111503
spack.hooks.pre_install(self.spec)
15121504
if is_setup:
1513-
pass # Don't write any files in the install...
1505+
self.stage = DIYStage(os.getcwd()) # Force build in cwd
1506+
1507+
spconfig_fname = self.name + '-setup.py'
1508+
tty.msg(
1509+
'Generating config file {0} [{1}]'.format(
1510+
spconfig_fname, self.spec.cshort_spec))
1511+
1512+
# Calls virtual function of subclass
1513+
# (eg: CMakePackage, MakefilePackage, etc.)
1514+
spconfig_fname = self.write_spconfig(
1515+
spack_env, spconfig_fname, dirty)
15141516
elif fake:
15151517
self.do_fake_install()
15161518
else:

0 commit comments

Comments
 (0)