Skip to content

Commit de14126

Browse files
authored
Merge pull request #51 from nexB/prep-31.0.1-release
Prep 31.0.1 release
2 parents d4fb39e + 311ae7e commit de14126

17 files changed

+215
-154
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.py[cod]
33

44
# virtualenv and other misc bits
5+
/src/*.egg-info
56
*.egg-info
67
/dist
78
/build

CHANGELOG.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
Release notes
22
=============
33

4-
Version (next)
4+
Version 31.0.1 - (2023-02-23)
55
------------------------------
66

7+
- Fix issue when instantiating a ``VirtualCodebase`` from a JSON where if there
8+
is no codebase attribute with the same name in the scan, then None is assigned
9+
to the codebase attribute instead of the default value that was passed in when
10+
VirtualCodebase was instantiated.
11+
https://github.com/nexB/commoncode/issues/48
12+
13+
- Update spdx-tools to 0.7.0rc0
14+
https://github.com/nexB/commoncode/pull/50
15+
716

817
Version 31.0.0 - (2022-08-24)
918
------------------------------

Makefile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) nexB Inc. and others. All rights reserved.
4+
# ScanCode is a trademark of nexB Inc.
5+
# SPDX-License-Identifier: Apache-2.0
6+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
7+
# See https://github.com/nexB/skeleton for support or download.
8+
# See https://aboutcode.org for more information about nexB OSS projects.
9+
#
10+
11+
# Python version can be specified with `$ PYTHON_EXE=python3.x make conf`
12+
PYTHON_EXE?=python3
13+
VENV=venv
14+
ACTIVATE?=. ${VENV}/bin/activate;
15+
16+
dev:
17+
@echo "-> Configure the development envt."
18+
./configure --dev
19+
20+
isort:
21+
@echo "-> Apply isort changes to ensure proper imports ordering"
22+
${VENV}/bin/isort --sl -l 100 src tests setup.py
23+
24+
black:
25+
@echo "-> Apply black code formatter"
26+
${VENV}/bin/black -l 100 src tests setup.py
27+
28+
doc8:
29+
@echo "-> Run doc8 validation"
30+
@${ACTIVATE} doc8 --max-line-length 100 --ignore-path docs/_build/ --quiet docs/
31+
32+
valid: isort black
33+
34+
check:
35+
@echo "-> Run pycodestyle (PEP8) validation"
36+
@${ACTIVATE} pycodestyle --max-line-length=100 --exclude=.eggs,venv,lib,thirdparty,docs,migrations,settings.py,.cache .
37+
@echo "-> Run isort imports ordering validation"
38+
@${ACTIVATE} isort --sl --check-only -l 100 setup.py src tests .
39+
@echo "-> Run black validation"
40+
@${ACTIVATE} black --check --check -l 100 src tests setup.py
41+
42+
clean:
43+
@echo "-> Clean the Python env"
44+
./configure --clean
45+
46+
test:
47+
@echo "-> Run the test suite"
48+
${VENV}/bin/pytest -vvs
49+
50+
docs:
51+
rm -rf docs/_build/
52+
@${ACTIVATE} sphinx-build docs/ docs/_build/
53+
54+
.PHONY: conf dev check valid black isort clean test docs

azure-pipelines.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,63 +15,63 @@ jobs:
1515
parameters:
1616
job_name: ubuntu18_cpython
1717
image_name: ubuntu-18.04
18-
python_versions: ['3.7', '3.8', '3.9', '3.10']
18+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
1919
test_suites:
2020
all: venv/bin/pytest -n 2 -vvs
2121

2222
- template: etc/ci/azure-posix.yml
2323
parameters:
2424
job_name: ubuntu20_cpython
2525
image_name: ubuntu-20.04
26-
python_versions: ['3.7', '3.8', '3.9', '3.10']
26+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
2727
test_suites:
2828
all: venv/bin/pytest -n 2 -vvs
2929

3030
- template: etc/ci/azure-posix.yml
3131
parameters:
3232
job_name: ubuntu22_cpython
3333
image_name: ubuntu-22.04
34-
python_versions: ['3.7', '3.8', '3.9', '3.10']
34+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
3535
test_suites:
3636
all: venv/bin/pytest -n 2 -vvs
3737

3838
- template: etc/ci/azure-posix.yml
3939
parameters:
4040
job_name: macos1015_cpython
4141
image_name: macos-10.15
42-
python_versions: ['3.7', '3.8', '3.9', '3.10']
42+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
4343
test_suites:
4444
all: venv/bin/pytest -n 2 -vvs
4545

4646
- template: etc/ci/azure-posix.yml
4747
parameters:
4848
job_name: macos11_cpython
4949
image_name: macos-11
50-
python_versions: ['3.7', '3.8', '3.9', '3.10']
50+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
5151
test_suites:
5252
all: venv/bin/pytest -n 2 -vvs
5353

5454
- template: etc/ci/azure-posix.yml
5555
parameters:
5656
job_name: macos12_cpython
5757
image_name: macos-12
58-
python_versions: ['3.7', '3.8', '3.9', '3.10']
58+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
5959
test_suites:
6060
all: venv/bin/pytest -n 2 -vvs
6161

6262
- template: etc/ci/azure-win.yml
6363
parameters:
6464
job_name: win2019_cpython
6565
image_name: windows-2019
66-
python_versions: ['3.7', '3.8', '3.9', '3.10']
66+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
6767
test_suites:
6868
all: venv\Scripts\pytest -n 2 -vvs
6969

7070
- template: etc/ci/azure-win.yml
7171
parameters:
7272
job_name: win2022_cpython
7373
image_name: windows-2022
74-
python_versions: ['3.7', '3.8', '3.9', '3.10']
74+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
7575
test_suites:
7676
all: venv\Scripts\pytest -n 2 -vvs
7777

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ DOCS_REQUIREMENTS="--editable .[docs] --constraint requirements.txt"
3636
VIRTUALENV_DIR=venv
3737

3838
# Cleanable files and directories to delete with the --clean option
39-
CLEANABLE="build venv"
39+
CLEANABLE="build dist venv .cache .eggs"
4040

4141
# extra arguments passed to pip
4242
PIP_EXTRA_ARGS=" "

configure.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ set "DOCS_REQUIREMENTS=--editable .[docs] --constraint requirements.txt"
3434
set "VIRTUALENV_DIR=venv"
3535

3636
@rem # Cleanable files and directories to delete with the --clean option
37-
set "CLEANABLE=build venv"
37+
set "CLEANABLE=build dist venv .cache .eggs"
3838

3939
@rem # extra arguments passed to pip
4040
set "PIP_EXTRA_ARGS= "

etc/scripts/README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Pre-requisites
2121
virtualenv or in the the main configured development virtualenv.
2222
These requireements need to be installed::
2323

24-
pip install --requirement etc/release/requirements.txt
24+
pip install --requirement etc/scripts/requirements.txt
2525

2626
TODO: we need to pin the versions of these tools
2727

@@ -34,7 +34,7 @@ Scripts
3434
~~~~~~~
3535

3636
**gen_requirements.py**: create/update requirements files from currently
37-
installed requirements.
37+
installed requirements.
3838

3939
**gen_requirements_dev.py** does the same but can subtract the main requirements
4040
to get extra requirements used in only development.
@@ -50,7 +50,7 @@ The sequence of commands to run are:
5050

5151
./configure --clean
5252
./configure
53-
python etc/release/gen_requirements.py --site-packages-dir <path to site-packages dir>
53+
python etc/scripts/gen_requirements.py --site-packages-dir <path to site-packages dir>
5454

5555
* You can optionally install or update extra main requirements after the
5656
./configure step such that these are included in the generated main requirements.
@@ -59,7 +59,7 @@ The sequence of commands to run are:
5959

6060
./configure --clean
6161
./configure --dev
62-
python etc/release/gen_requirements_dev.py --site-packages-dir <path to site-packages dir>
62+
python etc/scripts/gen_requirements_dev.py --site-packages-dir <path to site-packages dir>
6363

6464
* You can optionally install or update extra dev requirements after the
6565
./configure step such that these are included in the generated dev

etc/scripts/fetch_thirdparty.py

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import itertools
1313
import os
1414
import sys
15+
from collections import defaultdict
1516

1617
import click
1718

@@ -110,6 +111,39 @@
110111
is_flag=True,
111112
help="Use on disk cached PyPI indexes list of packages and versions and do not refetch if present.",
112113
)
114+
@click.option(
115+
"--sdist-only",
116+
"sdist_only",
117+
type=str,
118+
metavar="SDIST",
119+
default=tuple(),
120+
show_default=False,
121+
multiple=True,
122+
help="Package name(s) that come only in sdist format (no wheels). "
123+
"The command will not fail and exit if no wheel exists for these names",
124+
)
125+
@click.option(
126+
"--wheel-only",
127+
"wheel_only",
128+
type=str,
129+
metavar="WHEEL",
130+
default=tuple(),
131+
show_default=False,
132+
multiple=True,
133+
help="Package name(s) that come only in wheel format (no sdist). "
134+
"The command will not fail and exit if no sdist exists for these names",
135+
)
136+
@click.option(
137+
"--no-dist",
138+
"no_dist",
139+
type=str,
140+
metavar="DIST",
141+
default=tuple(),
142+
show_default=False,
143+
multiple=True,
144+
help="Package name(s) that do not come either in wheel or sdist format. "
145+
"The command will not fail and exit if no distribution exists for these names",
146+
)
113147
@click.help_option("-h", "--help")
114148
def fetch_thirdparty(
115149
requirements_files,
@@ -122,6 +156,9 @@ def fetch_thirdparty(
122156
sdists,
123157
index_urls,
124158
use_cached_index,
159+
sdist_only,
160+
wheel_only,
161+
no_dist,
125162
):
126163
"""
127164
Download to --dest THIRDPARTY_DIR the PyPI wheels, source distributions,
@@ -204,58 +241,62 @@ def fetch_thirdparty(
204241
)
205242
repos.append(repo)
206243

207-
wheels_fetched = []
208-
wheels_not_found = []
209-
210-
sdists_fetched = []
211-
sdists_not_found = []
244+
wheels_or_sdist_not_found = defaultdict(list)
212245

213246
for name, version in sorted(required_name_versions):
214247
nv = name, version
215248
print(f"Processing: {name} @ {version}")
216249
if wheels:
217250
for environment in environments:
251+
218252
if TRACE:
219253
print(f" ==> Fetching wheel for envt: {environment}")
220-
fwfns = utils_thirdparty.download_wheel(
254+
255+
fetched = utils_thirdparty.download_wheel(
221256
name=name,
222257
version=version,
223258
environment=environment,
224259
dest_dir=dest_dir,
225260
repos=repos,
226261
)
227-
if fwfns:
228-
wheels_fetched.extend(fwfns)
229-
else:
230-
wheels_not_found.append(f"{name}=={version} for: {environment}")
262+
if not fetched:
263+
wheels_or_sdist_not_found[f"{name}=={version}"].append(environment)
231264
if TRACE:
232265
print(f" NOT FOUND")
233266

234-
if sdists:
267+
if (sdists or
268+
(f"{name}=={version}" in wheels_or_sdist_not_found and name in sdist_only)
269+
):
235270
if TRACE:
236271
print(f" ==> Fetching sdist: {name}=={version}")
272+
237273
fetched = utils_thirdparty.download_sdist(
238274
name=name,
239275
version=version,
240276
dest_dir=dest_dir,
241277
repos=repos,
242278
)
243-
if fetched:
244-
sdists_fetched.append(fetched)
245-
else:
246-
sdists_not_found.append(f"{name}=={version}")
279+
if not fetched:
280+
wheels_or_sdist_not_found[f"{name}=={version}"].append("sdist")
247281
if TRACE:
248282
print(f" NOT FOUND")
249283

250-
if wheels and wheels_not_found:
251-
print(f"==> MISSING WHEELS")
252-
for wh in wheels_not_found:
253-
print(f" {wh}")
284+
mia = []
285+
for nv, dists in wheels_or_sdist_not_found.items():
286+
name, _, version = nv.partition("==")
287+
if name in no_dist:
288+
continue
289+
sdist_missing = sdists and "sdist" in dists and not name in wheel_only
290+
if sdist_missing:
291+
mia.append(f"SDist missing: {nv} {dists}")
292+
wheels_missing = wheels and any(d for d in dists if d != "sdist") and not name in sdist_only
293+
if wheels_missing:
294+
mia.append(f"Wheels missing: {nv} {dists}")
254295

255-
if sdists and sdists_not_found:
256-
print(f"==> MISSING SDISTS")
257-
for sd in sdists_not_found:
258-
print(f" {sd}")
296+
if mia:
297+
for m in mia:
298+
print(m)
299+
raise Exception(mia)
259300

260301
print(f"==> FETCHING OR CREATING ABOUT AND LICENSE FILES")
261302
utils_thirdparty.fetch_abouts_and_licenses(dest_dir=dest_dir, use_cached_index=use_cached_index)

etc/scripts/gen_pypi_simple.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def build_per_package_index(pkg_name, packages, base_url):
118118
<body>"""
119119
document.append(header)
120120

121-
for package in packages:
121+
for package in sorted(packages, key=lambda p: p.archive_file):
122122
document.append(package.simple_index_entry(base_url))
123123

124124
footer = """ </body>
@@ -141,8 +141,8 @@ def build_links_package_index(packages_by_package_name, base_url):
141141
<body>"""
142142
document.append(header)
143143

144-
for _name, packages in packages_by_package_name.items():
145-
for package in packages:
144+
for _name, packages in sorted(packages_by_package_name.items(), key=lambda i: i[0]):
145+
for package in sorted(packages, key=lambda p: p.archive_file):
146146
document.append(package.simple_index_entry(base_url))
147147

148148
footer = """ </body>

etc/scripts/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ pip
88
setuptools
99
twine
1010
wheel
11-
build
11+
build
12+
packvers

0 commit comments

Comments
 (0)