Skip to content

Commit

Permalink
use style from spack pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
haampie committed Oct 16, 2024
1 parent e8acdd6 commit d05b1c0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 72 deletions.
29 changes: 7 additions & 22 deletions clingo/scripts/clingo_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,21 @@

# Dictionary that maps (OS, TARGET) to info for the spec
SPEC_INFO = {
("rhel5", "x86_64"): {
"spec": "clingo-bootstrap%gcc platform=linux target=x86_64",
},
("centos7", "x86_64"): {
"spec": "clingo-bootstrap%gcc platform=linux target=x86_64",
},
("centos7", "aarch64"): {
"spec": "clingo-bootstrap%gcc platform=linux target=aarch64",
},
("centos7", "ppc64le"): {
"spec": "clingo-bootstrap%gcc platform=linux target=ppc64le",
},
("monterey", "x86_64"): {
"spec": "clingo-bootstrap%apple-clang platform=darwin target=x86_64",
},
("rhel5", "x86_64"): {"spec": "clingo-bootstrap%gcc platform=linux target=x86_64"},
("centos7", "x86_64"): {"spec": "clingo-bootstrap%gcc platform=linux target=x86_64"},
("centos7", "aarch64"): {"spec": "clingo-bootstrap%gcc platform=linux target=aarch64"},
("centos7", "ppc64le"): {"spec": "clingo-bootstrap%gcc platform=linux target=ppc64le"},
("monterey", "x86_64"): {"spec": "clingo-bootstrap%apple-clang platform=darwin target=x86_64"},
("ventura", "aarch64"): {
"spec": "clingo-bootstrap%apple-clang platform=darwin target=aarch64",
"spec": "clingo-bootstrap%apple-clang platform=darwin target=aarch64"
},
}


def compiler_entry(name, version, os, target):
return {
"spec": "{0}@{1}".format(name, version),
"paths": {
"cc": "/dev/null",
"cxx": "/dev/null",
"f77": "/dev/null",
"fc": "/dev/null",
},
"paths": {"cc": "/dev/null", "cxx": "/dev/null", "f77": "/dev/null", "fc": "/dev/null"},
"operating_system": "{0}".format(os),
"target": "{0}".format(target),
"modules": [],
Expand Down
4 changes: 1 addition & 3 deletions clingo/scripts/install_clingo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@
f"Installing clingo-bootstrap with Python: "
f"{spack.bootstrap.config.spec_for_current_python()}"
)
install(
f"clingo-bootstrap@spack +optimized ~docs target={archspec.cpu.host().family}"
)
install(f"clingo-bootstrap@spack +optimized ~docs target={archspec.cpu.host().family}")
36 changes: 8 additions & 28 deletions gnupg/scripts/gnupg_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,18 @@

# Dictionary that maps (OS, TARGET) to info for the spec
SPEC_INFO = {
("centos7", "x86_64"): {
"spec": "[email protected]: %gcc platform=linux target=x86_64",
},
("centos7", "aarch64"): {
"spec": "[email protected]: %gcc platform=linux target=aarch64",
},
("centos7", "ppc64le"): {
"spec": "[email protected]: %gcc platform=linux target=ppc64le",
},
("monterey", "x86_64"): {
"spec": "[email protected]: %apple-clang platform=darwin target=x86_64",
},
("ventura", "aarch64"): {
"spec": "[email protected]: %apple-clang platform=darwin target=aarch64",
},
("centos7", "x86_64"): {"spec": "[email protected]: %gcc platform=linux target=x86_64"},
("centos7", "aarch64"): {"spec": "[email protected]: %gcc platform=linux target=aarch64"},
("centos7", "ppc64le"): {"spec": "[email protected]: %gcc platform=linux target=ppc64le"},
("monterey", "x86_64"): {"spec": "[email protected]: %apple-clang platform=darwin target=x86_64"},
("ventura", "aarch64"): {"spec": "[email protected]: %apple-clang platform=darwin target=aarch64"},
}


def compiler_entry(name, version, os, target):
return {
"spec": "{0}@{1}".format(name, version),
"paths": {
"cc": "/dev/null",
"cxx": "/dev/null",
"f77": "/dev/null",
"fc": "/dev/null",
},
"paths": {"cc": "/dev/null", "cxx": "/dev/null", "f77": "/dev/null", "fc": "/dev/null"},
"operating_system": "{0}".format(os),
"target": "{0}".format(target),
"modules": [],
Expand Down Expand Up @@ -80,9 +65,7 @@ def tarball_hash(path):
s = spack.spec.Spec.from_specfile(spec_json)
binaries = []
for edge in reversed(
spack.traverse.traverse_edges_topo(
[s], direction="children", deptype=("link", "run")
)
spack.traverse.traverse_edges_topo([s], direction="children", deptype=("link", "run"))
):
if edge.spec.external:
continue
Expand Down Expand Up @@ -110,10 +93,7 @@ def tarball_hash(path):
current_target = current_target["name"]

current_hash = binary_data["gnupg"]["hash"]
mirror_entry = {
"spec": SPEC_INFO[(current_os, current_target)]["spec"],
"binaries": binaries,
}
mirror_entry = {"spec": SPEC_INFO[(current_os, current_target)]["spec"], "binaries": binaries}
mirror_info.append(mirror_entry)

mirror_info = sorted(mirror_info, key=lambda x: x["spec"])
Expand Down
24 changes: 5 additions & 19 deletions patchelf/scripts/patchelf_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,16 @@

# Dictionary that maps (OS, TARGET) to info for the spec
SPEC_INFO = {
("centos7", "x86_64"): {
"spec": "[email protected]: %gcc platform=linux target=x86_64",
},
("centos7", "aarch64"): {
"spec": "[email protected]: %gcc platform=linux target=aarch64",
},
("centos7", "ppc64le"): {
"spec": "[email protected]: %gcc platform=linux target=ppc64le",
},
("centos7", "x86_64"): {"spec": "[email protected]: %gcc platform=linux target=x86_64"},
("centos7", "aarch64"): {"spec": "[email protected]: %gcc platform=linux target=aarch64"},
("centos7", "ppc64le"): {"spec": "[email protected]: %gcc platform=linux target=ppc64le"},
}


def compiler_entry(name, version, os, target):
return {
"spec": "{0}@{1}".format(name, version),
"paths": {
"cc": "/dev/null",
"cxx": "/dev/null",
"f77": "/dev/null",
"fc": "/dev/null",
},
"paths": {"cc": "/dev/null", "cxx": "/dev/null", "f77": "/dev/null", "fc": "/dev/null"},
"operating_system": "{0}".format(os),
"target": "{0}".format(target),
"modules": [],
Expand Down Expand Up @@ -84,10 +73,7 @@ def tarball_hash(path):

current_hash = binary_data["patchelf"]["hash"]
binaries = [("patchelf", current_hash, shas[current_hash])]
mirror_entry = {
"spec": SPEC_INFO[(current_os, current_target)]["spec"],
"binaries": binaries,
}
mirror_entry = {"spec": SPEC_INFO[(current_os, current_target)]["spec"], "binaries": binaries}
mirror_info.append(mirror_entry)

mirror_info = sorted(mirror_info, key=lambda x: x["spec"])
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tool.black]
line-length = 99
target-version = ['py36', 'py37', 'py38', 'py39', 'py310']
skip_magic_trailing_comma = true

[tool.isort]
line_length = 99
profile = "black"
honor_noqa = true

0 comments on commit d05b1c0

Please sign in to comment.