move package_hash from util to main library

This commit is contained in:
Gregory Becker 2024-02-14 13:41:07 -08:00
parent 6e24ea55ea
commit 4516b742dd
6 changed files with 18 additions and 15 deletions

View File

@ -499,7 +499,7 @@ def _ensure_packages_are_pickeleable(pkgs, error_cls):
@package_properties
def _ensure_packages_are_unparseable(pkgs, error_cls):
"""Ensure that all packages can unparse and that unparsed code is valid Python"""
import spack.util.package_hash as ph
import spack.package_hash as ph
errors = []
for pkg_name in pkgs:
@ -646,9 +646,11 @@ def _linting_package_file(pkgs, error_cls):
if pkg_cls.homepage.startswith("http://"):
https = re.sub("http", "https", pkg_cls.homepage, 1)
try:
response = urlopen(https,
verify_ssl=spack.config.get("config:verify_ssl", True),
timeout=spack.config.get("config:connect_timeout", 10))
response = urlopen(
https,
verify_ssl=spack.config.get("config:verify_ssl", True),
timeout=spack.config.get("config:connect_timeout", 10),
)
except Exception as e:
msg = 'Error with attempting https for "{0}": '
errors.append(error_cls(msg.format(pkg_cls.name), [str(e)]))

View File

@ -12,10 +12,10 @@
from llnl.util.tty.colify import colify
import spack.cmd
import spack.package_hash as ph
import spack.paths
import spack.repo
import spack.util.executable as exe
import spack.util.package_hash as ph
from spack.cmd.common import arguments
description = "query packages associated with particular git revisions"

View File

@ -4,7 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# flake8: noqa: F401
"""spack.util.package is a set of useful build tools and directives for packages.
"""spack.package is a set of useful build tools and directives for packages.
Everything in this module is automatically imported into Spack package files.
"""

View File

@ -63,9 +63,9 @@
install_test_root,
)
from spack.installer import InstallError, PackageInstaller
from spack.package_hash import package_hash
from spack.stage import DIYStage, ResourceStage, Stage, StageComposite, compute_stage_name
from spack.util.executable import ProcessError, which
from spack.util.package_hash import package_hash
from spack.version import GitVersion, StandardVersion, Version
FLAG_HANDLER_RETURN_TYPE = Tuple[
@ -829,8 +829,9 @@ def name(cls):
@classproperty
def global_license_dir(cls):
"""Returns the directory where license files for all packages are stored."""
return spack.util.path.canonicalize_path(spack.config.get("config:license_dir"),
replacements=spack.paths.path_replacements())
return spack.util.path.canonicalize_path(
spack.config.get("config:license_dir"), replacements=spack.paths.path_replacements()
)
@property
def global_license_file(self):
@ -987,11 +988,11 @@ def find_valid_url_for_version(self, version):
for u in urls:
if spack.util.web.url_exists(
u,
fetch_method=spack.config.get('config:url_fetch_method', 'urllib'),
verify_ssl=spack.config.get('config:verify_ssl'),
timeout=spack.config.get('config:connect_timeout', 10)
):
u,
fetch_method=spack.config.get("config:url_fetch_method", "urllib"),
verify_ssl=spack.config.get("config:verify_ssl"),
timeout=spack.config.get("config:connect_timeout", 10),
):
return u
return None

View File

@ -9,9 +9,9 @@
import pytest
import spack.directives
import spack.package_hash as ph
import spack.paths
import spack.repo
import spack.util.package_hash as ph
from spack.spec import Spec
from spack.util.unparse import unparse