remove self-import cycles (#46371)

This commit is contained in:
Harmen Stoppels 2024-09-13 11:16:36 +02:00 committed by GitHub
parent 668aba15a0
commit 71df434d1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 9 deletions

View File

@ -308,8 +308,7 @@ def __call__(self):
return t.render(**self.to_dict()) return t.render(**self.to_dict())
import spack.container.writers.docker # noqa: E402
# Import after function definition all the modules in this package, # Import after function definition all the modules in this package,
# so that registration of writers will happen automatically # so that registration of writers will happen automatically
import spack.container.writers.singularity # noqa: E402 from . import docker # noqa: F401 E402
from . import singularity # noqa: F401 E402

View File

@ -29,7 +29,6 @@
import spack.config import spack.config
import spack.error import spack.error
import spack.fetch_strategy import spack.fetch_strategy
import spack.mirror
import spack.oci.image import spack.oci.image
import spack.repo import spack.repo
import spack.spec import spack.spec

View File

@ -46,7 +46,6 @@
import spack.deptypes as dt import spack.deptypes as dt
import spack.environment import spack.environment
import spack.error import spack.error
import spack.modules.common
import spack.paths import spack.paths
import spack.projections as proj import spack.projections as proj
import spack.repo import spack.repo
@ -352,7 +351,7 @@ def get_module(module_type, spec, get_full_path, module_set_name="default", requ
except spack.repo.UnknownPackageError: except spack.repo.UnknownPackageError:
upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash()) upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash())
if upstream: if upstream:
module = spack.modules.common.upstream_module_index.upstream_module(spec, module_type) module = upstream_module_index.upstream_module(spec, module_type)
if not module: if not module:
return None return None

View File

@ -39,7 +39,6 @@
import spack.paths import spack.paths
import spack.resource import spack.resource
import spack.spec import spack.spec
import spack.stage
import spack.util.crypto import spack.util.crypto
import spack.util.lock import spack.util.lock
import spack.util.path as sup import spack.util.path as sup
@ -981,8 +980,8 @@ def interactive_version_filter(
data = buffer.getvalue().encode("utf-8") data = buffer.getvalue().encode("utf-8")
short_hash = hashlib.sha1(data).hexdigest()[:7] short_hash = hashlib.sha1(data).hexdigest()[:7]
filename = f"{spack.stage.stage_prefix}versions-{short_hash}.txt" filename = f"{stage_prefix}versions-{short_hash}.txt"
filepath = os.path.join(spack.stage.get_stage_root(), filename) filepath = os.path.join(get_stage_root(), filename)
# Write contents # Write contents
with open(filepath, "wb") as f: with open(filepath, "wb") as f: