Fix for missing format_doc in package-list command.
This commit is contained in:
parent
488a6737b7
commit
193eddda5e
@ -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"
|
||||
|
||||
|
@ -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 @@
|
||||
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 "-----"
|
||||
|
||||
|
@ -40,6 +40,8 @@
|
||||
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 @@ def do_clean_dist(self):
|
||||
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__)
|
||||
|
Loading…
Reference in New Issue
Block a user