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.
This commit is contained in:
parent
3b8b13809e
commit
e82992ae32
@ -67,10 +67,14 @@
|
|||||||
|
|
||||||
def _all_spack_files(root=spack.paths.prefix):
|
def _all_spack_files(root=spack.paths.prefix):
|
||||||
"""Generates root-relative paths of all files in the spack repository."""
|
"""Generates root-relative paths of all files in the spack repository."""
|
||||||
|
visited = set()
|
||||||
for cur_root, folders, files in os.walk(root):
|
for cur_root, folders, files in os.walk(root):
|
||||||
for filename in files:
|
for filename in files:
|
||||||
path = os.path.join(cur_root, filename)
|
path = os.path.realpath(os.path.join(cur_root, filename))
|
||||||
|
|
||||||
|
if path not in visited:
|
||||||
yield os.path.relpath(path, root)
|
yield os.path.relpath(path, root)
|
||||||
|
visited.add(path)
|
||||||
|
|
||||||
|
|
||||||
def _licensed_files(root=spack.paths.prefix):
|
def _licensed_files(root=spack.paths.prefix):
|
||||||
@ -81,7 +85,7 @@ def _licensed_files(root=spack.paths.prefix):
|
|||||||
|
|
||||||
def list_files(args):
|
def list_files(args):
|
||||||
"""list files in spack that should have license headers"""
|
"""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))
|
print(os.path.join(spack.paths.spack_root, relpath))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user