Skip to content

Commit

Permalink
Do not use packaging.LegacyVersion #3171 #3177
Browse files Browse the repository at this point in the history
* Switch to using packvers fork of packaging
* Bump pip requirements parser, but it still using packaging.
* Bump dparse2 which is using packvers
* Pin SPDX tools for cope with breaking APIs
* Update release script to build one release wheel for each Python
  version that each contain a pickle of the License index
* Streamline the app build
* Bump version and use correct SPDX version

Signed-off-by: Philippe Ombredanne <[email protected]>
  • Loading branch information
pombredanne committed Dec 23, 2022
1 parent ded56e9 commit b4f497c
Show file tree
Hide file tree
Showing 24 changed files with 270 additions and 222 deletions.
171 changes: 71 additions & 100 deletions .github/workflows/scancode-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ on:
permissions: {}
jobs:

build_scancode_for_pypi:
build_scancode_wheel_for_pypi:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build PyPI archives
name: Build PyPI wheels
runs-on: ubuntu-20.04

defaults:
Expand All @@ -33,51 +33,65 @@ jobs:

strategy:
fail-fast: true
matrix:
pyver: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2

- name: Set up Python
- name: Set up Python on ${{ matrix.pyver }}
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: ${{ matrix.pyver }}

- name: Install requirements then build main and mini wheel and sdist
run: etc/release/scancode-create-pypi-dist.sh
- name: Install requirements then build main and mini wheel
run: etc/release/scancode-create-pypi-wheel.sh

- name: Collect built main wheel
- name: Collect built wheels for ${{ matrix.pyver }}
uses: actions/upload-artifact@v3
with:
name: main_wheel
path: dist/scancode_toolkit-3*.whl
name: wheels-${{ matrix.pyver }}
path: dist/*.whl

- name: Collect built main sdist
uses: actions/upload-artifact@v3
with:
name: main_sdist
path: dist/scancode-toolkit-3*.tar.gz

- name: Collect built mini wheel
uses: actions/upload-artifact@v3
build_scancode_sdist_for_pypi:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build PyPI sdist archives
runs-on: ubuntu-20.04

defaults:
run:
shell: bash

strategy:
fail-fast: true

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
name: mini_wheel
path: dist/scancode_toolkit_mini-3*.whl
python-version: "3.10"

- name: Collect built mini sdist
- name: Install requirements then build main and mini sdist
run: etc/release/scancode-create-pypi-sdist.sh

- name: Collect built sdist
uses: actions/upload-artifact@v3
with:
name: mini_sdist
path: dist/scancode-toolkit-mini*.tar.gz
name: sdists
path: dist/*.tar.gz


build_scancode_for_release_linux:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build Release for linux
name: Build app Release for linux
runs-on: ubuntu-20.04
needs:
- build_scancode_for_pypi

defaults:
run:
Expand All @@ -92,18 +106,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Download a the main wheel
uses: actions/download-artifact@v3
with:
name: main_wheel
path: dist
python-version: "3.8"

- name: Build linux app archive
run: |
./configure --rel
etc/release/scancode-create-release-app-linux.sh
run: etc/release/scancode-create-release-app-linux.sh

- name: Collect built linux app
uses: actions/upload-artifact@v3
Expand All @@ -116,10 +122,8 @@ jobs:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build Release for mac
name: Build app Release for mac
runs-on: ubuntu-20.04
needs:
- build_scancode_for_pypi

defaults:
run:
Expand All @@ -134,18 +138,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Download a the main wheel
uses: actions/download-artifact@v3
with:
name: main_wheel
path: dist
python-version: "3.8"

- name: Build mac app archive
run: |
./configure --rel
etc/release/scancode-create-release-app-macos.sh
run: etc/release/scancode-create-release-app-macos.sh

- name: Collect built mac app
uses: actions/upload-artifact@v3
Expand All @@ -158,10 +154,8 @@ jobs:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build Release for windows
name: Build app Release for windows
runs-on: ubuntu-20.04
needs:
- build_scancode_for_pypi

defaults:
run:
Expand All @@ -175,18 +169,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Download a the main wheel
uses: actions/download-artifact@v3
with:
name: main_wheel
path: dist
python-version: "3.8"

- name: Build windows app archive
run: |
./configure --rel
etc/release/scancode-create-release-app-windows.sh
run: etc/release/scancode-create-release-app-windows.sh

- name: Collect built windows app
uses: actions/upload-artifact@v3
Expand All @@ -199,10 +185,8 @@ jobs:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build source
name: Build app source
runs-on: ubuntu-20.04
needs:
- build_scancode_for_pypi

defaults:
run:
Expand All @@ -216,18 +200,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Download a the main sdist
uses: actions/download-artifact@v3
with:
name: main_sdist
path: dist
python-version: "3.10"

- name: Build source archive with deps
run: |
./configure --rel
etc/release/scancode-create-release-app-sources.sh
run: etc/release/scancode-create-release-app-sources.sh

- name: Collect built source app tarball
uses: actions/upload-artifact@v3
Expand All @@ -236,13 +212,13 @@ jobs:
path: release/*


smoke_test_install_and_run_pypi_dists_posix:
smoke_test_install_and_run_pypi_wheels_on_posix:
permissions:
contents: read # to fetch code (actions/checkout)

name: Test POSIX PyPI wheels
name: Test PyPI wheels on linux and mac
needs:
- build_scancode_for_pypi
- build_scancode_wheel_for_pypi
runs-on: ${{ matrix.os }}

defaults:
Expand All @@ -252,10 +228,8 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, macos-12]
pyver: ["3.9", "3.10"]
# os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-10.15, macos-11, macos-12]
# pyver: ["3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]
pyver: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -265,10 +239,10 @@ jobs:
with:
python-version: ${{ matrix.pyver }}

- name: Download a single artifact mainw
- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: main_wheel
name: wheels-${{ matrix.pyver }}
path: dist

- name: test install wheels
Expand All @@ -277,21 +251,20 @@ jobs:
rm -rf venv; \
python -m venv venv
venv/bin/python -m pip install --upgrade pip wheel setuptools
for f in `find dist -type f`; \
for f in `find dist -type f -name "*${{ matrix.pyver }}*"`; \
do \
venv/bin/python -m pip install --force-reinstall "$f[full]" ; \
venv/bin/scancode -clipeu --json-pp - some.file ; \
venv/bin/python -m pip uninstall --yes scancode-toolkit ; \
done
smoke_test_install_and_run_pypi_dists_windows:
smoke_test_install_and_run_pypi_wheels_on_windows:
permissions:
contents: read # to fetch code (actions/checkout)

name: Test Windows PyPI wheels
name: Test PyPI wheels on Windows
needs:
- build_scancode_for_pypi
- build_scancode_wheel_for_pypi
runs-on: ${{ matrix.os }}

defaults:
Expand All @@ -301,10 +274,8 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [windows-2022]
pyver: ["3.9", "3.10"]
#os: [windows-2019, windows-2022]
#pyver: ["3.7", "3.8", "3.9", "3.10"]
os: [windows-2019, windows-2022]
pyver: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -314,22 +285,21 @@ jobs:
with:
python-version: ${{ matrix.pyver }}

- name: Download a single artifact mainw
- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: main_wheel
name: wheels-${{ matrix.pyver }}
path: dist

- name: test install wheel
run: |
echo "license: gpl-2.0" > some.file
python -m venv venv
venv/Scripts/python.exe -m pip install --upgrade pip
for f in `find dist -type f`; \
for f in `find dist -type f -name "*${{ matrix.pyver }}*"`; \
do \
venv/Scripts/python.exe -m pip install --force-reinstall "$f[full]" ; \
venv/Scripts/scancode -clipeu --json-pp - some.file ; \
venv/Scripts/python.exe -m pip uninstall --yes scancode-toolkit ; \
done
Expand Down Expand Up @@ -390,7 +360,7 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [macos-10.15, macos-11, macos-12]
os: [macos-11, macos-12]
pyver: [3.8]

steps:
Expand Down Expand Up @@ -509,9 +479,10 @@ jobs:
publish_to_pypi:
name: Publish to PyPI
needs:
- build_scancode_for_pypi
- smoke_test_install_and_run_pypi_dists_windows
- smoke_test_install_and_run_pypi_dists_posix
- build_scancode_wheel_for_pypi
- build_scancode_sdist_for_pypi
- smoke_test_install_and_run_pypi_wheels_on_windows
- smoke_test_install_and_run_pypi_wheels_on_posix
- publish_to_gh_release
runs-on: ubuntu-20.04
defaults:
Expand All @@ -520,7 +491,7 @@ jobs:
strategy:
fail-fast: true
matrix:
dist_names: [main_wheel, main_sdist, mini_wheel, mini_sdist]
dist_names: ["wheels-3.7", "wheels-3.8", "wheels-3.9", "wheels-3.10", sdists]

steps:
- name: Set up Python
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ License detection:
detected license only once. This data can contain the reference license text
as an option.


v31.2.3 - 2022-12-24
----------------------------------

This is a minor bugfix release.

There is a fix for an installation issue with the new "packaging" version 22.0.
This is replaced by a fork named "packvers" to work around
https://github.com/pypa/packaging/issues/530

We also improved the compatibility for pre-built wheels and now build one
wheel for each Python version to work around some Python pickle bug.


v31.2.1 - 2022-10-05
----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Installation

Before installing ScanCode make sure that you have installed the prerequisites
properly. This means installing Python 3.8 for x86/64 architectures.
We support Python 3.7, 3.8, 3.9 and 3.10.
We support Python 3.8, 3.9 and 3.10.

See `prerequisites <https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#prerequisites>`_
for detailed information on the support platforms and Python versions.
Expand Down
Loading

0 comments on commit b4f497c

Please sign in to comment.