Build a self-contained Win32 Python wheel for Concordance #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request builds a 32-bit Win32 Python wheel for libconcord, the bindings and all of its dependencies. This wheel simplifies the installation (and removal) process on Windows. It also fixes the DLL load path issue, including the changes to DLL load path made in Python 3.8+.
The wheel may be used individually, or as part of an installation process. In the companion pull request to Congruity, we consume this wheel to make an all-in-one installer for Congruity. It installs a self-contained 32-bit version of Python, Congruity, this wheel, and all other package and binary dependencies required.
Because the compiled DLLs are 32-bit, a 32-bit Python version is required to use them. However, the 32-bit Python (and our installer) will happily run on a 64-bit Windows system. The wheel is compatible with and tested on Windows 11, 10, and 8.1, both the 32- and 64-bit versions.
The wheel is built as part of the
ci-windows.yml
GitHub workflow via the addedmake_wheel.py
, which dynamically assembles the package using the same files that are built for the NSIS installer. A test has been added for the wheel to this workflow as well, based on the similar test present inci-linux.yml
.The wheel and bindings are compatible with Python versions
both pre- andpost-3.8. In Python 3.8 (released in 2019), the DLL search path was narrowed, andos.add_dll_directory
was introduced (link). We usewith os.add_dll_directory
to add the package directory to Python’s DLL search path when loading the libconcord DLLs (after which it’s immediately removed). If an app wants the DLLs in a different directory, the app can callos.add_dll_directory
before importing the libconcord bindings.Fallback logic has been added to perform a similar method using PATH (temporary for the calling process only) when the bindings are used on Python 3.7 or earlier andos.add_dll_directory
is not available.The binding behavior, Python package format, and version compatibility are unchanged for Linux/Mac. On these platforms, the changes to
libconcord.py
are silently ignored.