From e7875b39f8e28e0c27d96926f7cab3f7839c0250 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Mon, 17 Aug 2020 23:29:50 +0200 Subject: [PATCH] Fix wheel check in linux workflow and improve it Change-Id: I3b208674649e41bca0285d00aa11cc5975eb971a --- .github/workflows/create-wheels.yaml | 6 ++---- .github/workflows/scripts/can_install.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/scripts/can_install.py diff --git a/.github/workflows/create-wheels.yaml b/.github/workflows/create-wheels.yaml index 1861353a68..f1c8b04f1e 100644 --- a/.github/workflows/create-wheels.yaml +++ b/.github/workflows/create-wheels.yaml @@ -214,10 +214,8 @@ jobs: # - check the c extension # - runs the tests run: | - pip install -q wheel - version=`python -W ignore -c 'from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag; print("{0}{1}-{2}".format(get_abbr_impl(), get_impl_ver(), get_abi_tag()))'` - echo Wheel tag ${{ matrix.python-version }}. Installed version $version. - if [[ "${{ matrix.python-version }}" = "$version" ]] + pip install packaging>=20.4 + if python .github/workflows/scripts/can_install.py "${{ matrix.python-version }}" then pip install -f dist --no-index sqlalchemy python -c 'from sqlalchemy import cprocessors, cresultproxy, cutils' diff --git a/.github/workflows/scripts/can_install.py b/.github/workflows/scripts/can_install.py new file mode 100644 index 0000000000..61685d9789 --- /dev/null +++ b/.github/workflows/scripts/can_install.py @@ -0,0 +1,24 @@ +import sys +from packaging import tags + +to_check = "--" +found = False +if len(sys.argv) > 1: + to_check = sys.argv[1] + for t in tags.sys_tags(): + start = "-".join(str(t).split("-")[:2]) + if to_check.lower() == start: + print( + "Wheel tag {0} matches installed version {1}.".format( + to_check, t + ) + ) + found = True + break +if not found: + print( + "Wheel tag {0} not found in installed version tags {1}.".format( + to_check, [str(t) for t in tags.sys_tags()] + ) + ) + exit(1) -- 2.47.3