Skip to content

Commit af87cfa

Browse files
Update CI runners and scripts
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
1 parent 4f9751c commit af87cfa

File tree

8 files changed

+46
-55
lines changed

8 files changed

+46
-55
lines changed

.github/workflows/docs-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
max-parallel: 4
1111
matrix:
12-
python-version: [3.12]
12+
python-version: [3.13]
1313

1414
steps:
1515
- name: Checkout code

.github/workflows/pypi-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ jobs:
3131
python-version: 3.12
3232

3333
- name: Install pypa/build and twine
34-
run: python -m pip install --user build twine
34+
run: python -m pip install --user --upgrade build twine pkginfo
3535

3636
- name: Build a binary wheel and a source tarball
37-
run: python -m build --sdist --wheel --outdir dist/
37+
run: python -m build --sdist --outdir dist/
3838

3939
- name: Validate wheel and sdis for Pypi
4040
run: python -m twine check dist/*

azure-pipelines.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,62 @@ jobs:
1111
parameters:
1212
job_name: run_code_checks
1313
image_name: ubuntu-24.04
14-
python_versions: ['3.12']
14+
python_versions: ['3.13']
1515
test_suites:
1616
all: make check
1717

1818
- template: etc/ci/azure-posix.yml
1919
parameters:
2020
job_name: ubuntu22_cpython
2121
image_name: ubuntu-22.04
22-
python_versions: ['3.9', '3.10', '3.11', '3.12']
22+
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
2323
test_suites:
2424
all: venv/bin/pytest -n 2 -vvs
2525

2626
- template: etc/ci/azure-posix.yml
2727
parameters:
2828
job_name: ubuntu24_cpython
2929
image_name: ubuntu-24.04
30-
python_versions: ['3.9', '3.10', '3.11', '3.12']
30+
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
3131
test_suites:
3232
all: venv/bin/pytest -n 2 -vvs
3333

3434
- template: etc/ci/azure-posix.yml
3535
parameters:
3636
job_name: macos13_cpython
3737
image_name: macOS-13
38-
python_versions: ['3.9', '3.10', '3.11', '3.12']
38+
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
3939
test_suites:
4040
all: venv/bin/pytest -n 2 -vvs
4141

4242
- template: etc/ci/azure-posix.yml
4343
parameters:
4444
job_name: macos14_cpython
4545
image_name: macOS-14
46-
python_versions: ['3.9', '3.10', '3.11', '3.12']
46+
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
4747
test_suites:
4848
all: venv/bin/pytest -n 2 -vvs
4949

5050
- template: etc/ci/azure-posix.yml
5151
parameters:
5252
job_name: macos15_cpython
5353
image_name: macOS-15
54-
python_versions: ['3.9', '3.10', '3.11', '3.12']
54+
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
5555
test_suites:
5656
all: venv/bin/pytest -n 2 -vvs
5757

58-
- template: etc/ci/azure-win.yml
59-
parameters:
60-
job_name: win2019_cpython
61-
image_name: windows-2019
62-
python_versions: ['3.9', '3.10', '3.11', '3.12']
63-
test_suites:
64-
all: venv\Scripts\pytest -n 2 -vvs
65-
6658
- template: etc/ci/azure-win.yml
6759
parameters:
6860
job_name: win2022_cpython
6961
image_name: windows-2022
70-
python_versions: ['3.9', '3.10', '3.11', '3.12']
62+
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
7163
test_suites:
7264
all: venv\Scripts\pytest -n 2 -vvs
7365

7466
- template: etc/ci/azure-win.yml
7567
parameters:
7668
job_name: win2025_cpython
7769
image_name: windows-2025
78-
python_versions: ['3.9', '3.10', '3.11', '3.12']
70+
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
7971
test_suites:
8072
all: venv\Scripts\pytest -n 2 -vvs

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ create_virtualenv() {
110110
fi
111111

112112
$PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \
113-
--wheel embed --pip embed --setuptools embed \
113+
--pip embed --setuptools embed \
114114
--seeder pip \
115115
--never-download \
116116
--no-periodic-update \

configure.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if not exist "%CFG_BIN_DIR%\python.exe" (
110110

111111
if exist "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" (
112112
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^
113-
--wheel embed --pip embed --setuptools embed ^
113+
--pip embed --setuptools embed ^
114114
--seeder pip ^
115115
--never-download ^
116116
--no-periodic-update ^
@@ -126,7 +126,7 @@ if not exist "%CFG_BIN_DIR%\python.exe" (
126126
)
127127
)
128128
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" ^
129-
--wheel embed --pip embed --setuptools embed ^
129+
--pip embed --setuptools embed ^
130130
--seeder pip ^
131131
--never-download ^
132132
--no-periodic-update ^

etc/ci/azure-container-deb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- job: ${{ parameters.job_name }}
2222

2323
pool:
24-
vmImage: 'ubuntu-16.04'
24+
vmImage: 'ubuntu-22.04'
2525

2626
container:
2727
image: ${{ parameters.container }}

etc/ci/azure-container-rpm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters:
22
job_name: ''
3-
image_name: 'ubuntu-16.04'
3+
image_name: 'ubuntu-22.04'
44
container: ''
55
python_path: ''
66
python_version: ''

etc/scripts/utils_thirdparty.py

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
23
#
34
# Copyright (c) nexB Inc. and others. All rights reserved.
45
# ScanCode is a trademark of nexB Inc.
@@ -24,13 +25,14 @@
2425
import packageurl
2526
import requests
2627
import saneyaml
27-
import utils_pip_compatibility_tags
2828
from commoncode import fileutils
2929
from commoncode.hash import multi_checksums
3030
from commoncode.text import python_safe_name
3131
from packvers import tags as packaging_tags
3232
from packvers import version as packaging_version
3333

34+
import utils_pip_compatibility_tags
35+
3436
"""
3537
Utilities to manage Python thirparty libraries source, binaries and metadata in
3638
local directories and remote repositories.
@@ -91,8 +93,7 @@
9193
9294
- parse requirement file
9395
- create a TODO queue of requirements to process
94-
- done: create an empty map of processed binary requirements as
95-
{package name: (list of versions/tags}
96+
- done: create an empty map of processed binary requirements as {package name: (list of versions/tags}
9697
9798
9899
- while we have package reqs in TODO queue, process one requirement:
@@ -114,13 +115,14 @@
114115
TRACE_ULTRA_DEEP = False
115116

116117
# Supported environments
117-
PYTHON_VERSIONS = "37", "38", "39", "310"
118+
PYTHON_VERSIONS = "39", "310", "311", "312", "313"
118119

119120
PYTHON_DOT_VERSIONS_BY_VER = {
120-
"37": "3.7",
121-
"38": "3.8",
122121
"39": "3.9",
123122
"310": "3.10",
123+
"311": "3.11",
124+
"312": "3.12",
125+
"313": "3.13",
124126
}
125127

126128

@@ -132,10 +134,11 @@ def get_python_dot_version(version):
132134

133135

134136
ABIS_BY_PYTHON_VERSION = {
135-
"37": ["cp37", "cp37m", "abi3"],
136-
"38": ["cp38", "cp38m", "abi3"],
137137
"39": ["cp39", "cp39m", "abi3"],
138138
"310": ["cp310", "cp310m", "abi3"],
139+
"311": ["cp311", "cp311m", "abi3"],
140+
"312": ["cp312", "cp312m", "abi3"],
141+
"313": ["cp313", "cp313m", "abi3"],
139142
}
140143

141144
PLATFORMS_BY_OS = {
@@ -553,8 +556,7 @@ def download(self, dest_dir=THIRDPARTY_DIR):
553556
Download this distribution into `dest_dir` directory.
554557
Return the fetched filename.
555558
"""
556-
if not self.filename:
557-
raise ValueError(f"self.filename has no value but is required: {self.filename!r}")
559+
assert self.filename
558560
if TRACE_DEEP:
559561
print(
560562
f"Fetching distribution of {self.name}=={self.version}:",
@@ -822,9 +824,9 @@ def fetch_license_files(self, dest_dir=THIRDPARTY_DIR, use_cached_index=False):
822824
"""
823825
urls = LinksRepository.from_url(use_cached_index=use_cached_index).links
824826
errors = []
825-
extra_lic_names = [lic.get("file") for lic in self.extra_data.get("licenses", {})]
827+
extra_lic_names = [l.get("file") for l in self.extra_data.get("licenses", {})]
826828
extra_lic_names += [self.extra_data.get("license_file")]
827-
extra_lic_names = [eln for eln in extra_lic_names if eln]
829+
extra_lic_names = [ln for ln in extra_lic_names if ln]
828830
lic_names = [f"{key}.LICENSE" for key in self.get_license_keys()]
829831
for filename in lic_names + extra_lic_names:
830832
floc = os.path.join(dest_dir, filename)
@@ -844,7 +846,7 @@ def fetch_license_files(self, dest_dir=THIRDPARTY_DIR, use_cached_index=False):
844846
if TRACE:
845847
print(f"Fetched license from remote: {lic_url}")
846848

847-
except Exception:
849+
except:
848850
try:
849851
# try licensedb second
850852
lic_url = f"{LICENSEDB_API_URL}/{filename}"
@@ -857,9 +859,8 @@ def fetch_license_files(self, dest_dir=THIRDPARTY_DIR, use_cached_index=False):
857859
if TRACE:
858860
print(f"Fetched license from licensedb: {lic_url}")
859861

860-
except Exception:
861-
msg = f"No text for license {filename} in expression "
862-
f"{self.license_expression!r} from {self}"
862+
except:
863+
msg = f'No text for license {filename} in expression "{self.license_expression}" from {self}'
863864
print(msg)
864865
errors.append(msg)
865866

@@ -999,7 +1000,7 @@ def get_license_link_for_filename(filename, urls):
9991000
exception if no link is found or if there are more than one link for that
10001001
file name.
10011002
"""
1002-
path_or_url = [url for url in urls if url.endswith(f"/{filename}")]
1003+
path_or_url = [l for l in urls if l.endswith(f"/{filename}")]
10031004
if not path_or_url:
10041005
raise Exception(f"Missing link to file: {filename}")
10051006
if not len(path_or_url) == 1:
@@ -1288,7 +1289,7 @@ def is_pure(self):
12881289
def is_pure_wheel(filename):
12891290
try:
12901291
return Wheel.from_filename(filename).is_pure()
1291-
except Exception:
1292+
except:
12921293
return False
12931294

12941295

@@ -1484,7 +1485,8 @@ def get_distributions(self):
14841485
"""
14851486
if self.sdist:
14861487
yield self.sdist
1487-
yield from self.wheels
1488+
for wheel in self.wheels:
1489+
yield wheel
14881490

14891491
def get_url_for_filename(self, filename):
14901492
"""
@@ -1613,8 +1615,7 @@ class PypiSimpleRepository:
16131615
type=dict,
16141616
default=attr.Factory(lambda: defaultdict(dict)),
16151617
metadata=dict(
1616-
help="Mapping of {name: {version: PypiPackage, version: PypiPackage, etc} "
1617-
"available in this repo"
1618+
help="Mapping of {name: {version: PypiPackage, version: PypiPackage, etc} available in this repo"
16181619
),
16191620
)
16201621

@@ -1628,8 +1629,7 @@ class PypiSimpleRepository:
16281629
type=bool,
16291630
default=False,
16301631
metadata=dict(
1631-
help="If True, use any existing on-disk cached PyPI index files. "
1632-
"Otherwise, fetch and cache."
1632+
help="If True, use any existing on-disk cached PyPI index files. Otherwise, fetch and cache."
16331633
),
16341634
)
16351635

@@ -1638,8 +1638,7 @@ def _get_package_versions_map(self, name):
16381638
Return a mapping of all available PypiPackage version for this package name.
16391639
The mapping may be empty. It is ordered by version from oldest to newest
16401640
"""
1641-
if not name:
1642-
raise ValueError(f"name is required: {name!r}")
1641+
assert name
16431642
normalized_name = NameVer.normalize_name(name)
16441643
versions = self.packages[normalized_name]
16451644
if not versions and normalized_name not in self.fetched_package_normalized_names:
@@ -1694,7 +1693,7 @@ def fetch_links(self, normalized_name):
16941693
)
16951694
links = collect_urls(text)
16961695
# TODO: keep sha256
1697-
links = [link.partition("#sha256=") for link in links]
1696+
links = [l.partition("#sha256=") for l in links]
16981697
links = [url for url, _, _sha256 in links]
16991698
return links
17001699

@@ -1915,7 +1914,7 @@ def get_remote_file_content(
19151914
# several redirects and that we can ignore content there. A HEAD request may
19161915
# not get us this last header
19171916
print(f" DOWNLOADING: {url}")
1918-
with requests.get(url, allow_redirects=True, stream=True, headers=headers) as response: # noqa: S113
1917+
with requests.get(url, allow_redirects=True, stream=True, headers=headers) as response:
19191918
status = response.status_code
19201919
if status != requests.codes.ok: # NOQA
19211920
if status == 429 and _delay < 20:
@@ -2134,7 +2133,7 @@ def call(args, verbose=TRACE):
21342133
"""
21352134
if TRACE_DEEP:
21362135
print("Calling:", " ".join(args))
2137-
with subprocess.Popen( # noqa: S603
2136+
with subprocess.Popen(
21382137
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8"
21392138
) as process:
21402139
stdouts = []
@@ -2199,7 +2198,7 @@ def download_wheels_with_pip(
21992198
cli_args.extend(["--requirement", req_file])
22002199

22012200
if TRACE:
2202-
print("Downloading wheels using command:", " ".join(cli_args))
2201+
print(f"Downloading wheels using command:", " ".join(cli_args))
22032202

22042203
existing = set(os.listdir(dest_dir))
22052204
error = False
@@ -2232,7 +2231,7 @@ def download_wheels_with_pip(
22322231

22332232
def check_about(dest_dir=THIRDPARTY_DIR):
22342233
try:
2235-
subprocess.check_output(f"venv/bin/about check {dest_dir}".split()) # noqa: S603
2234+
subprocess.check_output(f"venv/bin/about check {dest_dir}".split())
22362235
except subprocess.CalledProcessError as cpe:
22372236
print()
22382237
print("Invalid ABOUT files:")
@@ -2283,5 +2282,5 @@ def get_license_expression(declared_licenses):
22832282
return get_only_expression_from_extracted_license(declared_licenses)
22842283
except ImportError:
22852284
# Scancode is not installed, clean and join all the licenses
2286-
lics = [python_safe_name(lic).lower() for lic in declared_licenses]
2285+
lics = [python_safe_name(l).lower() for l in declared_licenses]
22872286
return " AND ".join(lics).lower()

0 commit comments

Comments
 (0)