Skip to content

Commit

Permalink
Fix CI-generated wheels (#1121)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
keitherskine authored Nov 13, 2022
1 parent 62b07fa commit ec1e3a7
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ubuntu_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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*"
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ x86/
# Executables
*.exe

# Linters
.flake8
.pylintrc

# Other
pyodbc.conf
tmp
Expand All @@ -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

1 change: 1 addition & 0 deletions appveyor/test_script.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit ec1e3a7

Please sign in to comment.