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
|
||||||
print "Description:"
|
print "Description:"
|
||||||
if pkg.__doc__:
|
if pkg.__doc__:
|
||||||
print format_doc(pkg, indent=4)
|
print pkg.format_doc(indent=4)
|
||||||
else:
|
else:
|
||||||
print " None"
|
print " None"
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import re
|
import re
|
||||||
import textwrap
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.tty.colify import *
|
from llnl.util.tty.colify import *
|
||||||
@ -32,21 +31,6 @@
|
|||||||
description = "Print a list of all packages in reStructuredText."
|
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):
|
def github_url(pkg):
|
||||||
"""Link to a package file on github."""
|
"""Link to a package file on github."""
|
||||||
return ("https://github.com/scalability-llnl/spack/blob/master/var/spack/packages/%s/package.py" %
|
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)
|
for d in pkg.dependencies)
|
||||||
print
|
print
|
||||||
print "Description"
|
print "Description"
|
||||||
print format_doc(pkg, indent=2)
|
print pkg.format_doc(indent=2)
|
||||||
print
|
print
|
||||||
print "-----"
|
print "-----"
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
import platform as py_platform
|
import platform as py_platform
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
import textwrap
|
||||||
|
from StringIO import StringIO
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.filesystem import *
|
from llnl.util.filesystem import *
|
||||||
@ -852,6 +854,23 @@ def do_clean_dist(self):
|
|||||||
self.stage.destroy()
|
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):
|
def fetch_available_versions(self):
|
||||||
if not hasattr(self, 'url'):
|
if not hasattr(self, 'url'):
|
||||||
raise VersionFetchError(self.__class__)
|
raise VersionFetchError(self.__class__)
|
||||||
|
Loading…
Reference in New Issue
Block a user