Move tty output commands out of package and into clean command.

This commit is contained in:
Todd Gamblin 2014-10-07 23:22:58 -07:00
parent 4bde771970
commit 1801a85966
2 changed files with 14 additions and 11 deletions

View File

@ -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)

View File

@ -427,7 +427,7 @@ def has_url(self):
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 @@ def url_version(self, version):
@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 @@ def do_clean(self):
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 @@ def do_clean_dist(self):
"""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):