summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-10-27 22:40:05 +0100
committerGitHub <noreply@github.com>2024-10-27 15:40:05 -0600
commit2ec4281c4f15358df38eb8daefddf5b76d2ba5c2 (patch)
tree810f288758f9cc54646e9140236cea5f74c10cf6 /lib
parente80d75cbe32978e53038d8598f594b58a6122c3c (diff)
downloadspack-2ec4281c4f15358df38eb8daefddf5b76d2ba5c2.tar.gz
spack-2ec4281c4f15358df38eb8daefddf5b76d2ba5c2.tar.bz2
spack-2ec4281c4f15358df38eb8daefddf5b76d2ba5c2.tar.xz
spack-2ec4281c4f15358df38eb8daefddf5b76d2ba5c2.zip
Remove a few redundant imports (#47250)
* remove self-imports * remove unused imports
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/bootstrap/core.py1
-rw-r--r--lib/spack/spack/mirror.py3
-rw-r--r--lib/spack/spack/package_base.py2
-rw-r--r--lib/spack/spack/repo.py11
-rw-r--r--lib/spack/spack/store.py5
-rw-r--r--lib/spack/spack/test/package_class.py1
6 files changed, 8 insertions, 15 deletions
diff --git a/lib/spack/spack/bootstrap/core.py b/lib/spack/spack/bootstrap/core.py
index ba2afa8f7f..7e40c5dea4 100644
--- a/lib/spack/spack/bootstrap/core.py
+++ b/lib/spack/spack/bootstrap/core.py
@@ -45,7 +45,6 @@ import spack.user_environment
import spack.util.executable
import spack.util.path
import spack.util.spack_yaml
-import spack.util.url
import spack.version
from spack.installer import PackageInstaller
diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py
index 4254763773..b320671361 100644
--- a/lib/spack/spack/mirror.py
+++ b/lib/spack/spack/mirror.py
@@ -29,7 +29,6 @@ import spack.caches
import spack.config
import spack.error
import spack.fetch_strategy
-import spack.mirror
import spack.oci.image
import spack.repo
import spack.spec
@@ -756,7 +755,7 @@ def create_mirror_from_package_object(pkg_obj, mirror_cache, mirror_stats):
def require_mirror_name(mirror_name):
"""Find a mirror by name and raise if it does not exist"""
- mirror = spack.mirror.MirrorCollection().get(mirror_name)
+ mirror = MirrorCollection().get(mirror_name)
if not mirror:
raise ValueError(f'no mirror named "{mirror_name}"')
return mirror
diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py
index 2f47caaa55..ef2f27cca6 100644
--- a/lib/spack/spack/package_base.py
+++ b/lib/spack/spack/package_base.py
@@ -32,7 +32,6 @@ import llnl.util.tty as tty
from llnl.util.lang import classproperty, memoized
from llnl.util.link_tree import LinkTree
-import spack.build_environment
import spack.builder
import spack.compilers
import spack.config
@@ -50,7 +49,6 @@ import spack.spec
import spack.store
import spack.url
import spack.util.environment
-import spack.util.executable
import spack.util.path
import spack.util.web
from spack.error import InstallError, NoURLError, PackageError
diff --git a/lib/spack/spack/repo.py b/lib/spack/spack/repo.py
index b916c3baef..3f54b02299 100644
--- a/lib/spack/spack/repo.py
+++ b/lib/spack/spack/repo.py
@@ -39,7 +39,6 @@ import spack.config
import spack.error
import spack.patch
import spack.provider_index
-import spack.repo
import spack.spec
import spack.tag
import spack.util.git
@@ -216,9 +215,9 @@ NOT_PROVIDED = object()
def packages_path():
"""Get the test repo if it is active, otherwise the builtin repo."""
try:
- return spack.repo.PATH.get_repo("builtin.mock").packages_path
- except spack.repo.UnknownNamespaceError:
- return spack.repo.PATH.get_repo("builtin").packages_path
+ return PATH.get_repo("builtin.mock").packages_path
+ except UnknownNamespaceError:
+ return PATH.get_repo("builtin").packages_path
class GitExe:
@@ -314,7 +313,7 @@ def add_package_to_git_stage(packages):
git = GitExe()
for pkg_name in packages:
- filename = spack.repo.PATH.filename_for_package_name(pkg_name)
+ filename = PATH.filename_for_package_name(pkg_name)
if not os.path.isfile(filename):
tty.die("No such package: %s. Path does not exist:" % pkg_name, filename)
@@ -1585,7 +1584,7 @@ class UnknownPackageError(UnknownEntityError):
long_msg = "Use 'spack create' to create a new package."
if not repo:
- repo = spack.repo.PATH
+ repo = PATH
# We need to compare the base package name
pkg_name = name.rsplit(".", 1)[-1]
diff --git a/lib/spack/spack/store.py b/lib/spack/spack/store.py
index 31369531d5..5884f24149 100644
--- a/lib/spack/spack/store.py
+++ b/lib/spack/spack/store.py
@@ -33,7 +33,6 @@ import spack.directory_layout
import spack.error
import spack.paths
import spack.spec
-import spack.store
import spack.util.path
#: default installation root, relative to the Spack install path
@@ -308,7 +307,7 @@ def find(
matching_specs: List[spack.spec.Spec] = []
errors = []
- query_fn = query_fn or spack.store.STORE.db.query
+ query_fn = query_fn or STORE.db.query
for spec in constraints:
current_matches = query_fn(spec, **kwargs)
@@ -341,7 +340,7 @@ def specfile_matches(filename: str, **kwargs) -> List["spack.spec.Spec"]:
**kwargs: keyword arguments forwarded to "find"
"""
query = [spack.spec.Spec.from_specfile(filename)]
- return spack.store.find(query, **kwargs)
+ return find(query, **kwargs)
def ensure_singleton_created() -> None:
diff --git a/lib/spack/spack/test/package_class.py b/lib/spack/spack/test/package_class.py
index 76ace98049..a8c541930b 100644
--- a/lib/spack/spack/test/package_class.py
+++ b/lib/spack/spack/test/package_class.py
@@ -18,7 +18,6 @@ import pytest
import llnl.util.filesystem as fs
import spack.compilers
-import spack.config
import spack.deptypes as dt
import spack.error
import spack.install_test