summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-12-31 22:02:56 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2019-01-01 00:44:28 -0800
commite82992ae32fcbc3310b4a24e1e2905b46c4babeb (patch)
treec6b0b1f298d9f9d12058580ab094a0538fe2e1a2
parent3b8b13809e4f9e8d7456c4d2e27d7ff069c8e44e (diff)
downloadspack-e82992ae32fcbc3310b4a24e1e2905b46c4babeb.tar.gz
spack-e82992ae32fcbc3310b4a24e1e2905b46c4babeb.tar.bz2
spack-e82992ae32fcbc3310b4a24e1e2905b46c4babeb.tar.xz
spack-e82992ae32fcbc3310b4a24e1e2905b46c4babeb.zip
license: license command prints sorted, non-redundant results
- spack license command now ignores symlinks - spack license list-files now prints sorted output, and checks for files we've already seen.
-rw-r--r--lib/spack/spack/cmd/license.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/spack/spack/cmd/license.py b/lib/spack/spack/cmd/license.py
index df208d8bbe..e3349c505d 100644
--- a/lib/spack/spack/cmd/license.py
+++ b/lib/spack/spack/cmd/license.py
@@ -67,10 +67,14 @@ lgpl_exceptions = [
def _all_spack_files(root=spack.paths.prefix):
"""Generates root-relative paths of all files in the spack repository."""
+ visited = set()
for cur_root, folders, files in os.walk(root):
for filename in files:
- path = os.path.join(cur_root, filename)
- yield os.path.relpath(path, root)
+ path = os.path.realpath(os.path.join(cur_root, filename))
+
+ if path not in visited:
+ yield os.path.relpath(path, root)
+ visited.add(path)
def _licensed_files(root=spack.paths.prefix):
@@ -81,7 +85,7 @@ def _licensed_files(root=spack.paths.prefix):
def list_files(args):
"""list files in spack that should have license headers"""
- for relpath in _licensed_files():
+ for relpath in sorted(_licensed_files()):
print(os.path.join(spack.paths.spack_root, relpath))