Use "vendoring" to manage 3rd party dependencies

This commit is contained in:
Massimiliano Culpo
2022-11-16 15:39:33 +01:00
committed by Todd Gamblin
parent 2530c7828b
commit 86378502f9
10 changed files with 92 additions and 70 deletions

View File

@@ -83,7 +83,7 @@ def __init__(self):
if version:
# If we found a CrayOS version, we do not want the information
# from LinuxDistro. In order to skip the logic from
# external.distro.linux_distribution, while still calling __init__
# distro.linux_distribution, while still calling __init__
# methods further up the MRO, we skip LinuxDistro in the MRO and
# call the OperatingSystem superclass __init__ method
super(LinuxDistro, self).__init__(name, version)

View File

@@ -15,9 +15,9 @@ def kernel_version():
"""Return the kernel version as a Version object.
Note that the kernel version is distinct from OS and/or
distribution versions. For instance:
>>> external.distro.id()
>>> distro.id()
'centos'
>>> external.distro.version()
>>> distro.version()
'7'
>>> platform.release()
'5.10.84+'
@@ -39,9 +39,9 @@ class LinuxDistro(OperatingSystem):
def __init__(self):
try:
# This will throw an error if imported on a non-Linux platform.
import external.distro
import distro
distname, version = external.distro.id(), external.distro.version()
distname, version = distro.id(), distro.version()
except ImportError:
distname, version = "unknown", ""

View File

@@ -9,8 +9,8 @@
import shutil
import sys
import jsonschema
import pytest
from jsonschema import ValidationError, validate
from llnl.util.filesystem import mkdirp, working_dir
@@ -1313,7 +1313,7 @@ def test_push_mirror_contents(
index_path = os.path.join(buildcache_path, "index.json")
with open(index_path) as idx_fd:
index_object = json.load(idx_fd)
validate(index_object, db_idx_schema)
jsonschema.validate(index_object, db_idx_schema)
# Now that index is regenerated, validate "buildcache list" output
buildcache_list_output = buildcache_cmd("list", output=str)
@@ -1325,7 +1325,7 @@ def test_push_mirror_contents(
spec_json_path = os.path.join(buildcache_path, file_name)
with open(spec_json_path) as json_fd:
json_object = Spec.extract_json_from_clearsig(json_fd.read())
validate(json_object, specfile_schema)
jsonschema.validate(json_object, specfile_schema)
logs_dir = working_dir.join("logs_dir")
if not os.path.exists(logs_dir.strpath):
@@ -1630,7 +1630,7 @@ def test_ci_rebuild_index(
index_path = os.path.join(buildcache_path, "index.json")
with open(index_path) as idx_fd:
index_object = json.load(idx_fd)
validate(index_object, db_idx_schema)
jsonschema.validate(index_object, db_idx_schema)
def test_ci_generate_bootstrap_prune_dag(
@@ -1911,21 +1911,21 @@ def test_ensure_only_one_temporary_storage():
# User can specify "enable-artifacts-buildcache" (boolean)
yaml_obj = syaml.load(gitlab_ci_template.format(enable_artifacts))
validate(yaml_obj, gitlab_ci_schema)
jsonschema.validate(yaml_obj, gitlab_ci_schema)
# User can also specify "temporary-storage-url-prefix" (string)
yaml_obj = syaml.load(gitlab_ci_template.format(temp_storage))
validate(yaml_obj, gitlab_ci_schema)
jsonschema.validate(yaml_obj, gitlab_ci_schema)
# However, specifying both should fail to validate
yaml_obj = syaml.load(gitlab_ci_template.format(specify_both))
with pytest.raises(ValidationError):
validate(yaml_obj, gitlab_ci_schema)
with pytest.raises(jsonschema.ValidationError):
jsonschema.validate(yaml_obj, gitlab_ci_schema)
# Specifying neither should be fine too, as neither of these properties
# should be required
yaml_obj = syaml.load(gitlab_ci_template.format(specify_neither))
validate(yaml_obj, gitlab_ci_schema)
jsonschema.validate(yaml_obj, gitlab_ci_schema)
def test_ci_generate_temp_storage_url(

View File

@@ -20,7 +20,7 @@
_use_uuid = False
pass
from jsonschema import validate
import jsonschema
import llnl.util.lock as lk
from llnl.util.tty.colify import colify
@@ -456,7 +456,7 @@ def test_005_db_exists(database):
with open(index_file) as fd:
index_object = json.load(fd)
validate(index_object, schema)
jsonschema.validate(index_object, schema)
def test_010_all_install_sanity(database):
@@ -750,7 +750,7 @@ def test_old_external_entries_prefix(mutable_database):
with open(spack.store.db._index_path, "r") as f:
db_obj = json.loads(f.read())
validate(db_obj, schema)
jsonschema.validate(db_obj, schema)
s = spack.spec.Spec("externaltool")
s.concretize()