@@ -1350,7 +1350,7 @@ def do_install(self,
13501350 tests = False ,
13511351 dirty = None ,
13521352 spack_env = None ,
1353- setup = set () ,
1353+ setup = None ,
13541354 ** kwargs ):
13551355 """Called by commands to install a package and its dependencies.
13561356
@@ -1387,18 +1387,20 @@ def do_install(self,
13871387 if not self .spec .concrete :
13881388 raise ValueError ("Can only install concrete packages: %s."
13891389 % self .spec .name )
1390+ setup = setup or set ()
13901391 is_setup = (self .name in setup )
1391-
1392+ if is_setup :
1393+ keep_prefix = True
13921394
13931395 # For external packages the workflow is simplified, and basically
13941396 # consists in module file generation and registration in the DB
13951397 if self .spec .external :
13961398 return self ._process_external_package (explicit )
13971399
1398-
13991400 if not is_setup :
14001401 restage = kwargs .get ('restage' , False )
1401- partial = self .check_for_unfinished_installation (keep_prefix , restage )
1402+ partial = self .check_for_unfinished_installation (
1403+ keep_prefix , restage )
14021404
14031405 # Ensure package is not already installed
14041406 layout = spack .store .layout
@@ -1440,9 +1442,7 @@ def do_install(self,
14401442 setup = setup ,
14411443 ** kwargs )
14421444
1443- this_fake = fake
14441445 if is_setup :
1445- this_fake = True
14461446 explicit = True
14471447 self .stage = DIYStage (os .getcwd ()) # Force build in cwd
14481448
@@ -1454,7 +1454,8 @@ def do_install(self,
14541454
14551455 # Calls virtual function of subclass
14561456 # (eg: CMakePackage, MakefilePackage, etc.)
1457- spconfig_fname = self .write_spconfig (spack_env , spconfig_fname , dirty )
1457+ spconfig_fname = self .write_spconfig (
1458+ spack_env , spconfig_fname , dirty )
14581459
14591460 tty .msg (colorize ('@*{Installing} @*g{%s}' % self .name ))
14601461
@@ -1488,7 +1489,7 @@ def build_process():
14881489 """
14891490
14901491 start_time = time .time ()
1491- if not this_fake :
1492+ if not ( fake or is_setup ) :
14921493 if not skip_patch :
14931494 self .do_patch ()
14941495 else :
@@ -1508,9 +1509,9 @@ def build_process():
15081509 # Run the pre-install hook in the child process after
15091510 # the directory is created.
15101511 spack .hooks .pre_install (self .spec )
1511- if self . name in setup :
1512+ if is_setup :
15121513 pass # Don't write any files in the install...
1513- elif this_fake :
1514+ elif fake :
15141515 self .do_fake_install ()
15151516 else :
15161517 source_path = self .stage .source_path
@@ -1550,7 +1551,7 @@ def build_process():
15501551 self ._total_time = time .time () - start_time
15511552 build_time = self ._total_time - self ._fetch_time
15521553
1553- if self . name in setup :
1554+ if is_setup :
15541555 tty .msg ("Successfully setup %s" % self .name ,
15551556 "Config file is %s" % spconfig_fname )
15561557 else :
@@ -1565,24 +1566,11 @@ def build_process():
15651566 return echo
15661567 # ------------------------- End of build_process()
15671568
1568- if is_setup :
1569- keep_prefix = True
1570-
15711569 # hook that allow tests to inspect this Package before installation
15721570 # see unit_test_check() docs.
15731571 if not self .unit_test_check ():
15741572 return
15751573
1576- try :
1577- spack .store .layout .create_install_directory (self .spec )
1578- except spack .directory_layout .InstallDirectoryAlreadyExistsError :
1579- # Abort install if install directory exists.
1580- # But do NOT remove it (you'd be overwriting someone else's stuff)
1581- tty .warn ("Keeping existing install prefix in place." )
1582- if is_setup :
1583- keep_prefix = True
1584- else :
1585- raise
15861574 try :
15871575 # Create the install prefix and fork the build process.
15881576 if not os .path .exists (self .prefix ):
@@ -1612,11 +1600,6 @@ def build_process():
16121600 spack .store .db .add (
16131601 self .spec , spack .store .layout , explicit = explicit
16141602 )
1615- except spack .directory_layout .InstallDirectoryAlreadyExistsError :
1616- # Abort install if install directory exists.
1617- # But do NOT remove it (you'd be overwriting someone else's stuff)
1618- tty .warn ("Keeping existing install prefix in place." )
1619- raise
16201603 except StopIteration as e :
16211604 # A StopIteration exception means that do_install
16221605 # was asked to stop early from clients
0 commit comments