Skip to content

Commit

Permalink
commands: remove unused spack list --format=rst (spack#11651)
Browse files Browse the repository at this point in the history
- We use `spack list --foramt=html` now, as it is much faster and doesn't
  make the docs build take forever.

- Remove `spack list --format=rst` as it is no longer used.
  • Loading branch information
tgamblin authored Jun 7, 2019
1 parent 7c8e9ab commit 06cc799
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 79 deletions.
72 changes: 0 additions & 72 deletions lib/spack/spack/cmd/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import sys
import math

from six import StringIO

import llnl.util.tty as tty
from llnl.util.tty.colify import colify

Expand Down Expand Up @@ -107,14 +105,6 @@ def github_url(pkg):
return url.format(pkg.name)


def rst_table(elts):
"""Print out a RST-style table."""
cols = StringIO()
ncol, widths = colify(elts, output=cols, tty=True)
header = ' '.join('=' * (w - 1) for w in widths)
return '%s\n%s%s' % (header, cols.getvalue(), header)


def rows_for_ncols(elts, ncols):
"""Print out rows in a table with ncols of elts laid out vertically."""
clen = int(math.ceil(len(elts) / ncols))
Expand All @@ -126,68 +116,6 @@ def rows_for_ncols(elts, ncols):
yield row


@formatter
def rst(pkg_names, out):
"""Print out information on all packages in restructured text."""

pkgs = [spack.repo.get(name) for name in pkg_names]

out.write('.. _package-list:\n')
out.write('\n')
out.write('============\n')
out.write('Package List\n')
out.write('============\n')
out.write('\n')
out.write('This is a list of things you can install using Spack. It is\n')
out.write(
'automatically generated based on the packages in the latest Spack\n')
out.write('release.\n')
out.write('\n')
out.write('Spack currently has %d mainline packages:\n' % len(pkgs))
out.write('\n')
out.write(rst_table('`%s`_' % p for p in pkg_names))
out.write('\n')
out.write('\n')

# Output some text for each package.
for pkg in pkgs:
out.write('-----\n')
out.write('\n')
out.write('.. _%s:\n' % pkg.name)
out.write('\n')
# Must be at least 2 long, breaks for single letter packages like R.
out.write('-' * max(len(pkg.name), 2))
out.write('\n')
out.write(pkg.name)
out.write('\n')
out.write('-' * max(len(pkg.name), 2))
out.write('\n\n')
out.write('Homepage:\n')
out.write(
' * `%s <%s>`__\n' % (cgi.escape(pkg.homepage), pkg.homepage))
out.write('\n')
out.write('Spack package:\n')
out.write(' * `%s/package.py <%s>`__\n' % (pkg.name, github_url(pkg)))
out.write('\n')
if pkg.versions:
out.write('Versions:\n')
out.write(' ' + ', '.join(str(v) for v in
reversed(sorted(pkg.versions))))
out.write('\n\n')

for deptype in spack.dependency.all_deptypes:
deps = pkg.dependencies_of_type(deptype)
if deps:
out.write('%s Dependencies\n' % deptype.capitalize())
out.write(' ' + ', '.join('%s_' % d if d in pkg_names
else d for d in deps))
out.write('\n\n')

out.write('Description:\n')
out.write(pkg.format_doc(indent=2))
out.write('\n\n')


@formatter
def html(pkg_names, out):
"""Print out information on all packages in Sphinx HTML.
Expand Down
7 changes: 0 additions & 7 deletions lib/spack/spack/test/cmd/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ def test_list_format_name_only():
assert 'hdf5' in output


@pytest.mark.maybeslow
def test_list_format_rst():
output = list('--format', 'rst')
assert '.. _cloverleaf3d:' in output
assert '.. _hdf5:' in output


@pytest.mark.maybeslow
def test_list_format_html():
output = list('--format', 'html')
Expand Down

0 comments on commit 06cc799

Please sign in to comment.