Merge pull request #1271 from paulhopkins/bugfix/package-list
Bugfix/package list
This commit is contained in:
		| @@ -22,10 +22,8 @@ | |||||||
| # License along with this program; if not, write to the Free Software | # License along with this program; if not, write to the Free Software | ||||||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
| ############################################################################## | ############################################################################## | ||||||
| import re |  | ||||||
| import cgi | import cgi | ||||||
| from StringIO import StringIO | from StringIO import StringIO | ||||||
| import llnl.util.tty as tty |  | ||||||
| from llnl.util.tty.colify import * | from llnl.util.tty.colify import * | ||||||
| import spack | import spack | ||||||
|  |  | ||||||
| @@ -34,21 +32,22 @@ | |||||||
|  |  | ||||||
| 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/llnl/spack/blob/master/var/spack/packages/%s/package.py" % |     url = "https://github.com/llnl/spack/blob/master/var/spack/packages/%s/package.py"  # NOQA: ignore=E501 | ||||||
|             pkg.name) |     return (url % pkg.name) | ||||||
|  |  | ||||||
|  |  | ||||||
| def rst_table(elts): | def rst_table(elts): | ||||||
|     """Print out a RST-style table.""" |     """Print out a RST-style table.""" | ||||||
|     cols = StringIO() |     cols = StringIO() | ||||||
|     ncol, widths = colify(elts, output=cols, tty=True) |     ncol, widths = colify(elts, output=cols, tty=True) | ||||||
|     header = " ".join("=" * (w-1) for w in widths) |     header = " ".join("=" * (w - 1) for w in widths) | ||||||
|     return "%s\n%s%s" % (header, cols.getvalue(), header) |     return "%s\n%s%s" % (header, cols.getvalue(), header) | ||||||
|  |  | ||||||
|  |  | ||||||
| def print_rst_package_list(): | def print_rst_package_list(): | ||||||
|     """Print out information on all packages in restructured text.""" |     """Print out information on all packages in restructured text.""" | ||||||
|     pkgs = sorted(spack.repo.all_packages(), key=lambda s:s.name.lower()) |     pkgs = sorted(spack.repo.all_packages(), key=lambda s: s.name.lower()) | ||||||
|  |     pkg_names = [p.name for p in pkgs] | ||||||
|  |  | ||||||
|     print ".. _package-list:" |     print ".. _package-list:" | ||||||
|     print |     print | ||||||
| @@ -62,7 +61,7 @@ def print_rst_package_list(): | |||||||
|  |  | ||||||
|     print "Spack currently has %d mainline packages:" % len(pkgs) |     print "Spack currently has %d mainline packages:" % len(pkgs) | ||||||
|     print |     print | ||||||
|     print rst_table("`%s`_" % p.name for p in pkgs) |     print rst_table("`%s`_" % p for p in pkg_names) | ||||||
|     print |     print | ||||||
|     print "-----" |     print "-----" | ||||||
|  |  | ||||||
| @@ -79,14 +78,15 @@ def print_rst_package_list(): | |||||||
|         print |         print | ||||||
|         if pkg.versions: |         if pkg.versions: | ||||||
|             print "Versions:" |             print "Versions:" | ||||||
|             print "  " + ", ".join(str(v) for v in reversed(sorted(pkg.versions))) |             print "  " + ", ".join(str(v) for v in | ||||||
|  |                                    reversed(sorted(pkg.versions))) | ||||||
|  |  | ||||||
|         for deptype in ('build', 'link', 'run'): |         for deptype in spack.alldeps: | ||||||
|             deps = pkg.dependencies(deptype) |             deps = pkg.dependencies_of_type(deptype) | ||||||
|             if deps: |             if deps: | ||||||
|                 print "%s Dependencies" % deptype.capitalize() |                 print "%s Dependencies" % deptype.capitalize() | ||||||
|                 print "  " + ", ".join("`%s`_" % d if d != "mpi" else d |                 print "  " + ", ".join("%s_" % d if d in pkg_names | ||||||
|                                        for d in build_deps) |                                        else d for d in deps) | ||||||
|                 print |                 print | ||||||
|  |  | ||||||
|         print "Description:" |         print "Description:" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin