simplify and speed up external list
This commit is contained in:
parent
57ac37eb67
commit
868d538958
@ -5,7 +5,7 @@
|
|||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
from collections import defaultdict
|
||||||
from typing import List, Optional, Set
|
from typing import List, Optional, Set
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
@ -17,7 +17,6 @@
|
|||||||
import spack.cray_manifest as cray_manifest
|
import spack.cray_manifest as cray_manifest
|
||||||
import spack.detection
|
import spack.detection
|
||||||
import spack.error
|
import spack.error
|
||||||
import spack.package_base
|
|
||||||
import spack.repo
|
import spack.repo
|
||||||
import spack.spec
|
import spack.spec
|
||||||
from spack.cmd.common import arguments
|
from spack.cmd.common import arguments
|
||||||
@ -246,13 +245,16 @@ def _collect_and_consume_cray_manifest_files(
|
|||||||
|
|
||||||
|
|
||||||
def external_list(args):
|
def external_list(args):
|
||||||
# Trigger a read of all packages, might take a long time.
|
|
||||||
list(spack.repo.PATH.all_package_classes())
|
|
||||||
# Print all the detectable packages
|
# Print all the detectable packages
|
||||||
tty.msg("Detectable packages per repository")
|
tty.msg("Detectable packages per repository")
|
||||||
for namespace, pkgs in sorted(spack.package_base.detectable_packages.items()):
|
repo_to_packages = defaultdict(list)
|
||||||
|
for fullname in spack.repo.PATH.packages_with_tags("detectable", full=True):
|
||||||
|
repo, _, pkg = fullname.rpartition(".")
|
||||||
|
repo_to_packages[repo].append(pkg)
|
||||||
|
|
||||||
|
for namespace in sorted(repo_to_packages):
|
||||||
print("Repository:", namespace)
|
print("Repository:", namespace)
|
||||||
colify.colify(pkgs, indent=4, output=sys.stdout)
|
colify.colify(repo_to_packages[namespace], indent=4)
|
||||||
|
|
||||||
|
|
||||||
def external(parser, args):
|
def external(parser, args):
|
||||||
|
@ -132,11 +132,6 @@ def windows_establish_runtime_linkage(self):
|
|||||||
win_rpath.establish_link()
|
win_rpath.establish_link()
|
||||||
|
|
||||||
|
|
||||||
#: Registers which are the detectable packages, by repo and package name
|
|
||||||
#: Need a pass of package repositories to be filled.
|
|
||||||
detectable_packages = collections.defaultdict(list)
|
|
||||||
|
|
||||||
|
|
||||||
class DetectablePackageMeta(type):
|
class DetectablePackageMeta(type):
|
||||||
"""Check if a package is detectable and add default implementations
|
"""Check if a package is detectable and add default implementations
|
||||||
for the detection function.
|
for the detection function.
|
||||||
@ -242,9 +237,6 @@ def determine_spec_details(cls, prefix, objs_in_prefix):
|
|||||||
def determine_variants(cls, objs, version_str):
|
def determine_variants(cls, objs, version_str):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# Register the class as a detectable package
|
|
||||||
detectable_packages[cls.namespace].append(cls.name)
|
|
||||||
|
|
||||||
# Attach function implementations to the detectable class
|
# Attach function implementations to the detectable class
|
||||||
default = False
|
default = False
|
||||||
if not hasattr(cls, "determine_spec_details"):
|
if not hasattr(cls, "determine_spec_details"):
|
||||||
|
Loading…
Reference in New Issue
Block a user