diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2014-11-06 11:46:43 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2014-11-06 11:46:43 -0800 |
commit | 193eddda5eea2e91c4f8f33e16224a7bd844ebfa (patch) | |
tree | c8fbea24225efc3007d050dbfaba619bf880df47 | |
parent | 488a6737b7cdb5095e0a0c79b9bd80c058dfda97 (diff) | |
download | spack-193eddda5eea2e91c4f8f33e16224a7bd844ebfa.tar.gz spack-193eddda5eea2e91c4f8f33e16224a7bd844ebfa.tar.bz2 spack-193eddda5eea2e91c4f8f33e16224a7bd844ebfa.tar.xz spack-193eddda5eea2e91c4f8f33e16224a7bd844ebfa.zip |
Fix for missing format_doc in package-list command.
-rw-r--r-- | lib/spack/spack/cmd/info.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/cmd/package-list.py | 18 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 19 |
3 files changed, 21 insertions, 18 deletions
diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py index 3e4ff627d5..eafafc601a 100644 --- a/lib/spack/spack/cmd/info.py +++ b/lib/spack/spack/cmd/info.py @@ -68,7 +68,7 @@ def print_text_info(pkg): print print "Description:" if pkg.__doc__: - print format_doc(pkg, indent=4) + print pkg.format_doc(indent=4) else: print " None" diff --git a/lib/spack/spack/cmd/package-list.py b/lib/spack/spack/cmd/package-list.py index aa576bddc2..87c528881e 100644 --- a/lib/spack/spack/cmd/package-list.py +++ b/lib/spack/spack/cmd/package-list.py @@ -23,7 +23,6 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import re -import textwrap from StringIO import StringIO import llnl.util.tty as tty from llnl.util.tty.colify import * @@ -32,21 +31,6 @@ import spack description = "Print a list of all packages in reStructuredText." -def format_doc(pkg, **kwargs): - """Wrap doc string at 72 characters and format nicely""" - indent = kwargs.get('indent', 0) - - if not pkg.__doc__: - return "" - - doc = re.sub(r'\s+', ' ', pkg.__doc__) - lines = textwrap.wrap(doc, 72) - results = StringIO() - for line in lines: - results.write((" " * indent) + line + "\n") - return results.getvalue() - - def github_url(pkg): """Link to a package file on github.""" return ("https://github.com/scalability-llnl/spack/blob/master/var/spack/packages/%s/package.py" % @@ -99,7 +83,7 @@ def print_rst_package_list(): for d in pkg.dependencies) print print "Description" - print format_doc(pkg, indent=2) + print pkg.format_doc(indent=2) print print "-----" diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 7cf94ed1ef..e4afb1d027 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -40,6 +40,8 @@ import subprocess import platform as py_platform import multiprocessing from urlparse import urlparse +import textwrap +from StringIO import StringIO import llnl.util.tty as tty from llnl.util.filesystem import * @@ -852,6 +854,23 @@ class Package(object): self.stage.destroy() + def format_doc(self, **kwargs): + """Wrap doc string at 72 characters and format nicely""" + indent = kwargs.get('indent', 0) + + if not self.__doc__: + return "" + + doc = re.sub(r'\s+', ' ', self.__doc__) + lines = textwrap.wrap(doc, 72) + results = StringIO() + for line in lines: + results.write((" " * indent) + line + "\n") + return results.getvalue() + + + + def fetch_available_versions(self): if not hasattr(self, 'url'): raise VersionFetchError(self.__class__) |