From 42610be2e5f7e4c6761c2ca96b304753c6ecc030 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 7 Feb 2014 09:28:50 -0800 Subject: Fix bugs that crept into spack clean when stage was refactored. --- lib/spack/spack/cmd/clean.py | 3 +-- lib/spack/spack/package.py | 4 ++-- lib/spack/spack/stage.py | 11 ++++++----- lib/spack/spack/test/stage.py | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/spack/spack/cmd/clean.py b/lib/spack/spack/cmd/clean.py index 8c8d90fe21..b86c3e502f 100644 --- a/lib/spack/spack/cmd/clean.py +++ b/lib/spack/spack/cmd/clean.py @@ -48,8 +48,7 @@ def clean(parser, args): specs = spack.cmd.parse_specs(args.packages, concretize=True) for spec in specs: - tty.msg("Cleaning for spec:", spec) - package = packages.get(spec.name) + package = packages.get(spec) if args.dist: package.do_clean_dist() elif args.work: diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 8675435492..ce4a98d99b 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -386,6 +386,8 @@ class Package(object): @property def stage(self): if not self.spec.concrete: + print self.spec + print self.spec.concrete raise ValueError("Can only get a stage for a concrete package.") if self._stage is None: @@ -564,8 +566,6 @@ class Package(object): """Creates a stage directory and downloads the taball for this package. Working directory will be set to the stage directory. """ - self.stage.setup() - if spack.do_checksum and not self.version in self.versions: tty.die("Cannot fetch %s@%s safely; there is no checksum on file for this " "version." % (self.name, self.version), diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index a4a5b93929..a278950546 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -42,8 +42,8 @@ class Stage(object): expanded, and built before being installed. It also handles downloading the archive. A stage's lifecycle looks like this: - setup() - Create the stage directory. + Stage() + Constructor creates the stage directory. fetch() Fetch a source archive into the stage. expand_archive() @@ -80,7 +80,9 @@ class Stage(object): self.tmp_root = find_tmp_root() self.url = url - self.path = None # This will be set after setup is called. + + self.path = None + self._setup() def _cleanup_dead_links(self): @@ -131,7 +133,7 @@ class Stage(object): return False - def setup(self): + def _setup(self): """Creates the stage directory. If spack.use_tmp_stage is False, the stage directory is created directly under spack.stage_path. @@ -206,7 +208,6 @@ class Stage(object): def chdir(self): """Changes directory to the stage path. Or dies if it is not set up.""" - self.setup() if os.path.isdir(self.path): os.chdir(self.path) else: diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py index 942baf6d46..102a692ca2 100644 --- a/lib/spack/spack/test/stage.py +++ b/lib/spack/spack/test/stage.py @@ -190,7 +190,6 @@ class StageTest(unittest.TestCase): def checkSetupAndDestroy(self, stage_name=None): stage = Stage(archive_url, name=stage_name) - stage.setup() self.check_setup(stage, stage_name) stage.destroy() -- cgit v1.2.3-60-g2f50