Skip to content

Commit e35541a

Browse files
authored
Whl (#24)
* prereq changes for build * more update * use correct script * just do mac temporarily * revert to all platforms * see what happens with wheels * tests only for linux * don't do linux-x64 wheels yet * add retries to redist downloads * extend retry
1 parent 600cf47 commit e35541a

7 files changed

Lines changed: 51 additions & 17 deletions

File tree

.github/workflows/release.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
matrix:
6262
buildplat:
6363
- [windows-2022, win_amd64, ""]
64-
- [ubuntu-22.04, manylinux_x86_64, ""]
64+
#- [ubuntu-22.04, manylinux_x86_64, ""]
6565
- [macos-14, macosx_arm64, ""]
6666

6767
python: ["cp39"]
@@ -110,7 +110,7 @@ jobs:
110110
sudo mkdir -p /opt/mqm || true;
111111
sudo installer -verbose -pkg tmpPkg-temp.pkg -target /opt/mqm && rm -rf tmpPkg-temp.pkg && ln -s /opt/mqm $MQ_FILE_PATH;
112112
;;
113-
*) echo "Unrecognised platform";exit 1;;
113+
*) echo "Unrecognised platform: $ImageOS";exit 1;;
114114
esac
115115
116116
# The original version of this YAML file used this pattern to select the download image. Leaving it here for
@@ -128,7 +128,10 @@ jobs:
128128
# The default repair command tries to merge the MQ shared libraries into the wheel,
129129
# We do not want that as it would breach the Redist Client licensing rules if we
130130
# re-uploaded that wheel to PyPI. So we will just do a simple copy.
131-
CIBW_REPAIR_WHEEL_COMMAND: cp {wheel} {dest_dir}
131+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: cp {wheel} {dest_dir}
132+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: cp {wheel} {dest_dir}
133+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: cp {wheel} {dest_dir}
134+
132135

133136
run: |
134137
python -m cibuildwheel --output-dir dist
@@ -162,7 +165,7 @@ jobs:
162165
run: |
163166
python -m build --sdist
164167
165-
- uses: actions/upload-artifact@v5
168+
- uses: actions/upload-artifact@v6
166169
with:
167170
name: artifact-sdist
168171
path: dist/*.tar.gz
@@ -175,7 +178,7 @@ jobs:
175178
# This permission is mandatory for trusted publishing, if we ever enable that
176179
id-token: write
177180
steps:
178-
- uses: actions/download-artifact@v5
181+
- uses: actions/download-artifact@v6
179182
with:
180183
pattern: artifact-*
181184
merge-multiple: true

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Newest updates are at the top of this file.
1919
* Add more typing information to function definitions
2020
* Testcases don't use the deprecated form of objects/functions
2121
* PyPI release includes binary wheels for some platforms
22+
* Not yet for Linux x64
2223

2324
## 2026 Apr 21 - V2.0.6
2425
* Better handling of message buffer sizes. Particularly for PCF operations (#21)

docs/Release.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ create the binary extension module.
77
Even with binary wheels, you must install independently the MQ Client components. The wheels do not include the MQ
88
product libraries.
99

10+
NOTE: For version 2.1.0, there is not a binary wheel supplied for Linux x64. Additional changes are required to
11+
the extension module to ensure the `manylinux` packaging works cleanly, and I didn't want to delay the rest of the
12+
release.
13+
1014
The C extension module is fairly agnostic as to the version of Python it's running with. It conforms to the [Limited
1115
API](https://docs.python.org/3/c-api/stable.html#limited-c-api) at the Python 3.9 level. This ought to make it easier to
1216
redistribute applications within your own environment, compiling only once and copying the `.so` file to other
@@ -18,7 +22,7 @@ wheels, but not to automatically upload them to PyPI. This is to allow local che
1822
own workflows, including use of other PyPI-equivalent servers for testing of the images. The build is triggered manually
1923
with the gh `workflow_dispatch` operation. The workflow configuration file does have some automatic steps (for example
2024
to run on PR creation), but they are commented out. The Redistributable Client packages are used to build binary wheels
21-
for Linux/x64 and Windows; the MacOS Developer Toolkit is used to do the same for that platform.
25+
for Windows; the MacOS Developer Toolkit is used to do the same for that platform.
2226

2327
The `runActions.sh` script controls the execution of the action, and the downloads of the sdist and wheel artifacts.
2428

tools/getRedistributables.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Download and extract the redistributable package to support building
2-
# the wheels on Windows and Linux.
1+
# Download and extract the MQ packages that support building
2+
# wheels on MacOS, Windows and Linux.
33
#
44
# Pass the source URL as the first argument and the destination directory
55
# as the second argument.
66
#
7-
# The source URL should end with .tar.gz or .zip
7+
# The source URL should end with .tar.gz (Linux) or .zip (Windows) or .pkg (MacOS)
88
#
99
import os
1010
import sys
11+
import time
1112
import tarfile
1213
import zipfile
1314

@@ -18,12 +19,16 @@
1819
sys.exit(1)
1920

2021
SOURCE_URL = sys.argv[1]
22+
# This is a directory
2123
DESTINATION_PATH = sys.argv[2]
2224

25+
# And we actually download to a file whose name starts with the destination directory
2326
if SOURCE_URL.endswith('.tar.gz'):
2427
temp_path = DESTINATION_PATH + '-temp.tar.gz'
2528
elif SOURCE_URL.endswith('.zip'):
2629
temp_path = DESTINATION_PATH + '-temp.zip'
30+
elif SOURCE_URL.endswith('.pkg'):
31+
temp_path = DESTINATION_PATH + '-temp.pkg'
2732
else:
2833
print("Unsupported archive format")
2934
sys.exit(1)
@@ -55,8 +60,27 @@ def extract_archive(archive_path, extract_to):
5560
raise ValueError("Unsupported archive format")
5661

5762

58-
print(f'Downloading "{SOURCE_URL}" to "{DESTINATION_PATH}"')
59-
download_file(SOURCE_URL, temp_path)
60-
extract_archive(temp_path, DESTINATION_PATH)
61-
os.unlink(temp_path)
63+
# If it's a .pkg file, that's for MacOS which we do not unpack here.
64+
# Instead, it'll be installed properly by the calling environment.
65+
print(f'Downloading "{SOURCE_URL}" to {temp_path}' )
66+
67+
cnt = 0
68+
while True:
69+
try:
70+
# A very simple retry mechanism as we've seen occasional DNS failures
71+
# on some github runners
72+
download_file(SOURCE_URL, temp_path)
73+
break
74+
except requests.exceptions.ConnectionError as e:
75+
if cnt == 3:
76+
print("Maximum retries reached")
77+
raise(e)
78+
print(f"Connection error {e}: sleeping")
79+
cnt = cnt + 1
80+
time.sleep(5)
81+
82+
if not SOURCE_URL.endswith('.pkg'):
83+
print(f'Extracting files from {temp_path} to {DESTINATION_PATH}')
84+
extract_archive(temp_path, DESTINATION_PATH)
85+
os.unlink(temp_path)
6286
print(f'Done via "{temp_path}"')

tools/pyRelease.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ fi
263263
export TWINE_USERNAME="__token__"
264264
export TWINE_PASSWORD="$tok"
265265

266-
# verboseUpload="--verbose"
266+
verboseUpload="--verbose"
267267

268268
# If using the local repository, then first make sure the pypi-server is running
269269
if $dryRun

tools/requirements-dev.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#
22
# Python packages required during the dev,test,release process.
33
#
4-
requests==2.33.0
5-
abi3audit==0.0.22
4+
requests>=2.33.0
5+
abi3audit==0.0.26
66
wheel==0.46.2
77
build==1.3.0
8+
cibuildwheel==3.3.1
9+

tools/runActions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rc=0
1515
if [ -z "$NORUN" ]
1616
then
1717
# This runs against the default (main) branch. Add '--ref my-branch' if needed
18-
gh workflow run release.yaml
18+
gh workflow run release.yaml --ref whl
1919
rc=$?
2020
if [ $rc -eq 0 ]
2121
then

0 commit comments

Comments
 (0)