directory_layout.py: remove dependency on global spack.store.STORE (#48460)

This commit is contained in:
Harmen Stoppels 2025-01-08 17:44:32 +01:00 committed by GitHub
parent 35963d7d7d
commit c424611010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,6 @@
import spack.hash_types as ht
import spack.projections
import spack.spec
import spack.store
import spack.util.spack_json as sjson
from spack.error import SpackError
@ -91,7 +90,6 @@ def __init__(
hash_length: Optional[int] = None,
) -> None:
self.root = root
self.check_upstream = True
projections = projections or default_projections
self.projections = {key: projection.lower() for key, projection in projections.items()}
@ -274,13 +272,6 @@ def path_for_spec(self, spec):
if spec.external:
return spec.external_path
if self.check_upstream:
upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash())
if upstream:
raise SpackError(
"Internal error: attempted to call path_for_spec on"
" upstream-installed package."
)
path = self.relative_path_for_spec(spec)
assert not path.startswith(self.root)