diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2014-10-07 23:22:58 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2014-10-07 23:22:58 -0700 |
commit | 1801a859666aae832e393a534c47064c68cb1b22 (patch) | |
tree | fd8f3fde40940713a3a6ebf7e6d7ff425da2f1f0 /lib | |
parent | 4bde771970547682142bf266ccd5001d99a0d07e (diff) | |
download | spack-1801a859666aae832e393a534c47064c68cb1b22.tar.gz spack-1801a859666aae832e393a534c47064c68cb1b22.tar.bz2 spack-1801a859666aae832e393a534c47064c68cb1b22.tar.xz spack-1801a859666aae832e393a534c47064c68cb1b22.zip |
Move tty output commands out of package and into clean command.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/clean.py | 10 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 15 |
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/spack/spack/cmd/clean.py b/lib/spack/spack/cmd/clean.py index 1df9d87ae2..79dd91c5bf 100644 --- a/lib/spack/spack/cmd/clean.py +++ b/lib/spack/spack/cmd/clean.py @@ -52,7 +52,15 @@ def clean(parser, args): package = spack.db.get(spec) if args.dist: package.do_clean_dist() + tty.msg("Cleaned %s" % package.name) + elif args.work: package.do_clean_work() + tty.msg("Restaged %s" % package.name) + else: - package.do_clean() + try: + package.do_clean() + except subprocess.CalledProcessError, e: + tty.warn("Warning: 'make clean' didn't work. Consider 'spack clean --work'.") + tty.msg("Made clean for %s" % package.name) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 59bfafa241..ee3e73a072 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -427,7 +427,7 @@ class Package(object): return self.url or self.version_urls() - # TODO: move this out of here and into some URL extrapolation module. + # TODO: move this out of here and into some URL extrapolation module? def url_for_version(self, version): """Returns a URL that you can download a new version of this package from.""" if not isinstance(version, Version): @@ -598,7 +598,7 @@ class Package(object): @property def default_url(self): - if self.concrete: + if self.spec.version.concrete: return self.url_for_version(self.version) else: url = getattr(self, 'url', None) @@ -841,13 +841,9 @@ class Package(object): def clean(self): """By default just runs make clean. Override if this isn't good.""" - try: - # TODO: should we really call make clean, ro just blow away the directory? - make = build_env.MakeExecutable('make', self.parallel) - make('clean') - tty.msg("Successfully cleaned %s" % self.name) - except subprocess.CalledProcessError, e: - tty.warn("Warning: 'make clean' didn't work. Consider 'spack clean --work'.") + # TODO: should we really call make clean, ro just blow away the directory? + make = build_env.MakeExecutable('make', self.parallel) + make('clean') def do_clean_work(self): @@ -859,7 +855,6 @@ class Package(object): """Removes the stage directory where this package was built.""" if os.path.exists(self.stage.path): self.stage.destroy() - tty.msg("Successfully cleaned %s" % self.name) def fetch_available_versions(self): |