summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-10-27 00:55:25 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-10-27 00:55:25 -0700
commit525344aa85199d6ceb6a25af4b454a5096ae369e (patch)
tree8fd1bd90573c5b7d1835981e29ccaccfbf19aa52 /lib
parent2e2e720a2a9f55af6d9e18f43d6c78e66c573c1a (diff)
downloadspack-525344aa85199d6ceb6a25af4b454a5096ae369e.tar.gz
spack-525344aa85199d6ceb6a25af4b454a5096ae369e.tar.bz2
spack-525344aa85199d6ceb6a25af4b454a5096ae369e.tar.xz
spack-525344aa85199d6ceb6a25af4b454a5096ae369e.zip
Make info command show VCS URLs properly.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/info.py32
-rw-r--r--lib/spack/spack/fetch_strategy.py19
2 files changed, 32 insertions, 19 deletions
diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py
index bb147b30f5..a1c35269be 100644
--- a/lib/spack/spack/cmd/info.py
+++ b/lib/spack/spack/cmd/info.py
@@ -26,6 +26,7 @@ import re
import textwrap
from llnl.util.tty.colify import colify
import spack
+import spack.fetch_strategy as fs
description = "Get detailed information on a particular package"
@@ -34,40 +35,41 @@ def setup_parser(subparser):
def info(parser, args):
- package = spack.db.get(args.name)
- print "Package: ", package.name
- print "Homepage: ", package.homepage
+ pkg = spack.db.get(args.name)
+ print "Package: ", pkg.name
+ print "Homepage: ", pkg.homepage
print
- print "Safe versions: "
+ print "Versions: "
- if not package.versions:
+ if not pkg.versions:
print("None.")
else:
- maxlen = max(len(str(v)) for v in package.versions)
+ maxlen = max(len(str(v)) for v in pkg.versions)
fmt = "%%-%ss" % maxlen
- for v in reversed(sorted(package.versions)):
- print " " + (fmt % v) + " " + package.url_for_version(v)
+ for v in reversed(sorted(pkg.versions)):
+ f = fs.for_package_version(pkg, v)
+ print " " + (fmt % v) + " " + str(f)
print
print "Dependencies:"
- if package.dependencies:
- colify(package.dependencies, indent=4)
+ if pkg.dependencies:
+ colify(pkg.dependencies, indent=4)
else:
print " None"
print
- print "Virtual packages: "
- if package.provided:
- for spec, when in package.provided.items():
+ print "Virtual pkgs: "
+ if pkg.provided:
+ for spec, when in pkg.provided.items():
print " %s provides %s" % (when, spec)
else:
print " None"
print
print "Description:"
- if package.__doc__:
- doc = re.sub(r'\s+', ' ', package.__doc__)
+ if pkg.__doc__:
+ doc = re.sub(r'\s+', ' ', pkg.__doc__)
lines = textwrap.wrap(doc, 72)
for line in lines:
print " " + line
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index f79051c500..779cd76bae 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -240,7 +240,7 @@ class URLFetchStrategy(FetchStrategy):
if self.url:
return self.url
else:
- return "URLFetchStrategy<no url>"
+ return "[no url]"
class VCSFetchStrategy(FetchStrategy):
@@ -293,7 +293,7 @@ class VCSFetchStrategy(FetchStrategy):
def __str__(self):
- return self.url
+ return "VCS: %s" % self.url
def __repr__(self):
@@ -396,6 +396,10 @@ class GitFetchStrategy(VCSFetchStrategy):
self.git('clean', '-f')
+ def __str__(self):
+ return "[git] %s" % self.url
+
+
class SvnFetchStrategy(VCSFetchStrategy):
"""Fetch strategy that gets source code from a subversion repository.
Use like this in a package:
@@ -469,6 +473,11 @@ class SvnFetchStrategy(VCSFetchStrategy):
self.svn('revert', '.', '-R')
+ def __str__(self):
+ return "[svn] %s" % self.url
+
+
+
class HgFetchStrategy(VCSFetchStrategy):
"""Fetch strategy that gets source code from a Mercurial repository.
Use like this in a package:
@@ -543,6 +552,10 @@ class HgFetchStrategy(VCSFetchStrategy):
self.stage.chdir_to_source()
+ def __str__(self):
+ return "[hg] %s" % self.url
+
+
def from_url(url):
"""Given a URL, find an appropriate fetch strategy for it.
Currently just gives you a URLFetchStrategy that uses curl.
@@ -630,5 +643,3 @@ class NoStageError(FetchError):
def __init__(self, method):
super(NoStageError, self).__init__(
"Must call FetchStrategy.set_stage() before calling %s" % method.__name__)
-
-