From ec1e3a78b808a713f50c9c776e691dc1edc97e5d Mon Sep 17 00:00:00 2001 From: Keith Erskine Date: Sun, 13 Nov 2022 12:10:19 -0600 Subject: [PATCH] Fix CI-generated wheels (#1121) * Fixed the package numbering in the wheels - e.g. "4.0.35" instead of "4.0.dev0" * Fixed Linux wheel filenames because PyPi was rejecting them with this error: Binary wheel 'pyodbc-4.0.35-cp36-cp36m-linux_x86_64.whl' has an unsupported platform tag 'linux_x86_64' * Added pyproject.toml file for PEP517 compliance --- .github/workflows/ubuntu_build.yml | 13 +++++++++++-- .gitignore | 5 ++++- appveyor/test_script.cmd | 1 + pyproject.toml | 3 +++ setup.py | 14 ++++++++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/ubuntu_build.yml b/.github/workflows/ubuntu_build.yml index b4dc12d8..270afd27 100644 --- a/.github/workflows/ubuntu_build.yml +++ b/.github/workflows/ubuntu_build.yml @@ -230,14 +230,23 @@ jobs: # macOS - both Intel and ARM builds; no bundled libraries CIBW_ARCHS_MACOS: "x86_64 arm64" + # prevent the addition of unixODBC dylibs to the wheel by simply not calling the repair CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" # Linux - based on CentOS 7; glibc 64-bit builds only; no bundled libraries # https://github.com/pypa/manylinux#docker-images CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_ARCHS_LINUX: x86_64 - CIBW_BEFORE_ALL_LINUX: yum -y install unixODBC-devel && odbcinst -j - CIBW_REPAIR_WHEEL_COMMAND_LINUX: "" + # this installs unixODBC 2.3.1 which is quite old but it has the latest ABI so should be fine + CIBW_BEFORE_ALL_LINUX: yum -y install unixODBC-devel + # the raw wheel filename is not PyPi compliant so the wheel must be repaired but + # suppress the addition of unixODBC libs to the wheel with --exclude's + CIBW_REPAIR_WHEEL_COMMAND_LINUX: + auditwheel repair + --exclude libodbc.so.2 + --exclude libltdl.so.7 + --wheel-dir {dest_dir} + {wheel} # Build choices - disable musl Linux and PyPy builds CIBW_SKIP: "*-musllinux_* pp*" diff --git a/.gitignore b/.gitignore index d153bb85..f7b64769 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,10 @@ x86/ # Executables *.exe +# Linters +.flake8 +.pylintrc + # Other pyodbc.conf tmp @@ -54,4 +58,3 @@ tags # The Access unit tests copy empty.accdb and empty.mdb to these names and use them. test.accdb test.mdb - diff --git a/appveyor/test_script.cmd b/appveyor/test_script.cmd index 92741d1c..43ce3c0b 100644 --- a/appveyor/test_script.cmd +++ b/appveyor/test_script.cmd @@ -9,6 +9,7 @@ ECHO *** Available ODBC Drivers: REM check if any testing should be done at all IF NOT "%APVYR_RUN_TESTS%" == "true" ( + ECHO. ECHO *** Skipping all the unit tests GOTO :end ) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..fed528d4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index e84fab42..312c5069 100755 --- a/setup.py +++ b/setup.py @@ -19,6 +19,10 @@ OFFICIAL_BUILD = 9999 +# This version identifier should refer to the NEXT release, not the +# current one. After each release, the version should be incremented. +VERSION = '4.0.35' + def _print(s): # Python 2/3 compatibility @@ -270,6 +274,16 @@ def get_version(): name = None # branch/feature name. Should be None for official builds. numbers = None # The 4 integers that make up the version. + # If we are in the CICD pipeline, use the VERSION. There is no tagging information available + # because Github Actions fetches the repo with the options --no-tags and --depth=1. + + # CI providers (Github Actions / Travis / CircleCI / AppVeyor / etc.) typically set CI to "true", but + # in cibuildwheel linux containers, the usual CI env vars are not available, only CIBUILDWHEEL. + if os.getenv('CI', 'false').lower() == 'true' or 'CIBUILDWHEEL' in os.environ: + name = VERSION + numbers = [int(p) for p in VERSION.split('.')] + return name, numbers + # If this is a source release the version will have already been assigned and be in the PKG-INFO file. name, numbers = _get_version_pkginfo()