Skip to content

Commit c6f72d7

Browse files
Inject it instead
1 parent 1ac219e commit c6f72d7

5 files changed

Lines changed: 78 additions & 37 deletions

File tree

.github/workflows/tests.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,28 @@ on:
1010
permissions: {}
1111

1212
jobs:
13-
tests:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
with:
18+
persist-credentials: false
19+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
20+
with:
21+
python-version: "3.14"
22+
- name: Install tox
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install --upgrade tox
26+
- name: Build wheel and sdist
27+
run: tox -e build
28+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
29+
with:
30+
name: dist
31+
path: dist/
1432

33+
tests:
34+
needs: build
1535
runs-on: ${{ matrix.os }}
1636
strategy:
1737
fail-fast: false
@@ -38,19 +58,24 @@ jobs:
3858
with:
3959
python-version: ${{ matrix.python-version }}
4060
allow-prereleases: true
61+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
62+
with:
63+
name: dist
64+
path: dist/
4165
- name: Install dependencies
4266
run: |
4367
python -m pip install --upgrade pip
4468
python -m pip install --upgrade tox
4569
- name: Run tests
70+
shell: bash
4671
run: |
47-
tox
72+
tox --installpkg dist/tzdata-*.whl
4873
4974
other:
5075
runs-on: "ubuntu-latest"
5176
strategy:
5277
matrix:
53-
toxenv: ["build", "precommit", "typing", "docs"]
78+
toxenv: ["precommit", "typing", "docs"]
5479
env:
5580
TOXENV: ${{ matrix.toxenv }}
5681

sbom.cdx.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json",
3+
"version": 1,
4+
"bomFormat": "CycloneDX",
5+
"specVersion": "1.7",
6+
"metadata": {
7+
"component": {
8+
"bom-ref": "pkg:pypi/tzdata@2026.1",
9+
"name": "tzdata",
10+
"version": "2026.1",
11+
"purl": "pkg:pypi/tzdata@2026.1",
12+
"type": "library",
13+
"components": [
14+
{
15+
"bom-ref": "https://www.iana.org/time-zones",
16+
"name": "tz",
17+
"version": "2026a",
18+
"type": "data",
19+
"data": [
20+
{
21+
"type": "dataset",
22+
"name": "IANA Time Zone Database",
23+
"description": "zic-compiled TZif timezone files"
24+
}
25+
],
26+
"licenses": [
27+
{
28+
"license": {
29+
"name": "tz database license",
30+
"url": "https://data.iana.org/time-zones/tz-link.html"
31+
}
32+
}
33+
]
34+
}
35+
]
36+
}
37+
}
38+
}

setup.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,7 @@ commands =
8181
python -c "from pathlib import Path; \
8282
[x.unlink(missing_ok=True) for x in Path('{toxinidir}/dist').glob('*')]"
8383
python -m build -o {toxinidir}/dist {toxinidir}
84+
python -c "import re, zipfile; from pathlib import Path; \
85+
d = Path('{toxinidir}/sbom.cdx.json').read_bytes(); \
86+
[((z := zipfile.ZipFile(w, 'a')).writestr(re.match(r'(.+?-.+?)-', w.name)[1] + '.dist-info/sboms/sbom.cdx.json', d), z.close()) for w in Path('{toxinidir}/dist').glob('*.whl')]"
8487
twine check {toxinidir}/dist/*

update.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ def create_package(version: str, zonenames: Sequence[str], zoneinfo_dir: pathlib
196196
with open(target_dir / "__init__.py", "w") as f_out:
197197
f_out.write(contents)
198198

199+
# Generate the SBOM from a template.
200+
with open(TEMPLATES_DIR / "sbom.cdx.json.in", "r") as f_in:
201+
contents = f_in.read()
202+
contents = contents.replace("%%PACKAGE_VERSION%%", package_version)
203+
contents = contents.replace("%%IANA_VERSION%%", version)
204+
205+
with open(REPO_ROOT / "sbom.cdx.json", "w") as f_out:
206+
f_out.write(contents)
207+
199208
with open(REPO_ROOT / "VERSION", "w") as f:
200209
f.write(package_version)
201210

0 commit comments

Comments
 (0)