Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Release
on:
push:
branches:
- default
# To simplify the release process, the publishing is triggered on tag.
# We should make sure to only push tags for new releases.
# If we start using tags for non-release purposes,
# this needs to be updated.
#
# We need to explicitly configure an expression that matches anything.
tags: [ "**" ]
pull_request:


env:
LINUX_URL: "https://bin.chevah.com:20443/third-party-stuff/ibm-mqc-redist/9.4.3.1-IBM-MQC-Redist-LinuxX64.tar.gz"
WINDOWS_URL: "https://bin.chevah.com:20443/third-party-stuff/ibm-mqc-redist/9.4.3.1-IBM-MQC-Redist-Win64.zip"

defaults:
run:
# Use bash on Windows for consistency.
shell: bash


jobs:
build_wheels:
name: Build ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.9'

- name: Install deps
run: |
python -m pip install -r tools/requirements-dev.txt

- name: Get IBM MQ C Linux Redistributables
if: matrix.runs-on == 'ubuntu-latest'
run: |
python tools/getRedistributables.py "$LINUX_URL" ibm-mq-c

- name: Get IBM MQ C Windows Redistributables
if: matrix.runs-on == 'windows-latest'
run: |
python tools/getRedistributables.py "$WINDOWS_URL" ibm-mq-c

- name: Build ibmmq wheels
run: |
export MQ_FILE_PATH=`pwd`/ibm-mq-c
python -m build --wheel

- name: Build C redistributables wheels
run: |
export MQ_FILE_PATH=`pwd`/ibm-mq-c
python -m build --wheel code/mqcredist
mv code/mqcredist/dist/*.whl dist/

- name: Check files
run: ls -al dist/

- name: Audit ABI3 wheels
run: |
abi3audit -vsS dist/*.whl

- uses: actions/upload-artifact@v4
with:
name: artifact-wheels-${{ matrix.runs-on }}
path: ./dist/*.whl


build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.9'

- name: Install build
run: |
python -m pip install build

- name: Build sdist and NOOP wheels
run: python -m build

- name: Build NOOP redistributables wheels
run: |
python -m build --wheel code/mqcredist
mv code/mqcredist/dist/*.whl dist/

- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*


upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist

- name: Check files
run: ls -al dist/

- name: Publish to PyPI - on tag
# Skip upload to PyPI if we don't have a tag
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1
2,228 changes: 2,228 additions & 0 deletions code/mqcredist/LICENSE.txt

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions code/mqcredist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# IBM MQ C libraries distributed as a Python package

This is a NOOP Python package designed to simplify the distribution of IBM MQ C
library files.
Designed to be used together with `ibmmq`.

They only support Windows X64 and Linux GLIC X64.

For all the other platforms, an empty wheel is generated.
This is designed to help unify the requirements for the dev tools.
You can then handle the empty wheel at the application level.


## Linux Usage

You need to use `LD_LIBRARY_PATH` to load the IBM C shared libraries.
They will be installed inside the virtual environment, at `lib/ibm-mq` path.

```
export LD_LIBRARY_PATH=YOUR_VENV/lib/ibm-mq/lib64/:YOUR_VENV/lib/ibm-mq/gskit8/lib64/
python your_ibm_mq_sample_code.py
```


## Windows Usage

The Microsoft Visual C++ 2013 Redistributable is required to build on
Windows systems.
This is a limitation of the IBM MQ C Client library.
The DLLs are copied in the wheel, so you don't need to install this on the
target systems.

The package copies the the IBM MQ libraries at `lib/ibm-mq` folder inside your
virtual environment.

You will need to setup Python to load the DLL from there.

```python
import os

if os.name == 'nt':
base_dll_dir = os.path.join(os.path.dirname(sys.executable), 'ibm-mq')
os.add_dll_directory(base_dll_dir)

import pymqi
```

## Licence

From the `licences/English.txt` found in the IBM MQ C redist archive:

> Redistributables may be distributed, in object-code form, only as part of Licensee's value-added application that was developed using the Program ("Licensee's Application") and only to support use of Licensee's Application.

I guess that this Python Package "application" adds some value, so the license is ok.
15 changes: 15 additions & 0 deletions code/mqcredist/mqcredist.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <Python.h>
/* This does nothing. Here to trigger building binary wheels. */

/* Module initialization */
static PyMethodDef module_methods[] = {
{NULL} /* Sentinel */
};

PyMODINIT_FUNC PyInit_mqcredist(void)
{
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT, "mqcredist", "Noop module", -1, module_methods,
};
return PyModule_Create(&moduledef);
}
24 changes: 24 additions & 0 deletions code/mqcredist/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"


[project]
name = "mqcredist"
version = "9.4.3"
Comment thread
adiroiban marked this conversation as resolved.
Outdated
description = "IBM MQ C library, distributed as wheels"
maintainers = [
{name = "Adi Roiban", email = "adiroiban@gmail.com"},
]
requires-python = ">= 3.9"
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
]
license = "LicenseRef-IBM-MQ-C-Redist"
license-files = ['LICENSE.txt']
[project.urls]
Homepage = "https://github.com/ibm-messaging/mq-mqi-python"

[options]
packages = "find:"
94 changes: 94 additions & 0 deletions code/mqcredist/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import os
from setuptools import setup, Extension

#
# This only supports Windows X64 and Linux GLIBC X64.
#

# Used to distribute the IBM MQ shared libraries with the wheel.
data_files = []
mq_file_path = os.environ.get('MQ_FILE_PATH', '')

if os.name == 'nt':
data_files = [
('ibm-mq/', [
mq_file_path + '/bin64/mqe.dll',
mq_file_path + '/bin64/mqic.dll',
Comment thread
adiroiban marked this conversation as resolved.
Outdated
]),
('ibm-mq/conv', [
mq_file_path + '/conv/ccsid.tbl',
mq_file_path + '/conv/ccsid_part2.tbl',
]),
('ibm-mq/bin64', [
mq_file_path + '/bin64/libcurl.dll',
]),
('ibm-mq/gskit8/lib64/', [
mq_file_path + '/gskit8/lib64/capicmd_res.dll',
mq_file_path + '/gskit8/lib64/gsk8acmeidup_64.dll',
mq_file_path + '/gskit8/lib64/gsk8cms_64.dll',
mq_file_path + '/gskit8/lib64/gsk8dbfl_64.dll',
mq_file_path + '/gskit8/lib64/gsk8iccs_64.dll',
mq_file_path + '/gskit8/lib64/gsk8kicc_64.dll',
mq_file_path + '/gskit8/lib64/gsk8km_64.dll',
mq_file_path + '/gskit8/lib64/gsk8p11_64.dll',
mq_file_path + '/gskit8/lib64/gsk8ssl_64.dll',
mq_file_path + '/gskit8/lib64/gsk8sys_64.dll',
mq_file_path + '/gskit8/lib64/gsk8valn_64.dll',
# VC++ 2012 runtime dependencies.
'c:/windows/system32/msvcp120.dll',
'c:/windows/system32/msvcr120.dll',
Comment thread
adiroiban marked this conversation as resolved.
]),
('ibm-mq/gskit8/lib64/N/icc/icclib', [
mq_file_path + '/gskit8/lib64/N/icc/icclib/ICCSIG.txt',
mq_file_path + '/gskit8/lib64/N/icc/icclib/icclib085.dll',
]),
]
else:
data_files = [
('lib/ibm-mq/lib', [
mq_file_path + '/lib/ccsid.tbl',
mq_file_path + '/lib/ccdt_schema.json',
mq_file_path + '/lib/ccsid_part2.tbl',
]),
('lib/ibm-mq/lib64', [
mq_file_path + '/lib64/libmqe_r.so',
mq_file_path + '/lib64/libmqe_r.so',
Comment thread
adiroiban marked this conversation as resolved.
Outdated
mq_file_path + '/lib64/libcurl.so',
]),
('lib/ibm-mq/gskit8/lib64', [
mq_file_path + '/gskit8/lib64/libgsk8acmeidup_64.so',
mq_file_path + '/gskit8/lib64/libgsk8cms_64.so', # curl
mq_file_path + '/gskit8/lib64/libgsk8dbfl_64.so',
mq_file_path + '/gskit8/lib64/libgsk8iccs_64.so',
mq_file_path + '/gskit8/lib64/libgsk8kicc_64.so',
mq_file_path + '/gskit8/lib64/libgsk8km_64.so',
mq_file_path + '/gskit8/lib64/libgsk8p11_64.so',
mq_file_path + '/gskit8/lib64/libgsk8ssl_64.so', # curl
mq_file_path + '/gskit8/lib64/libgsk8sys_64.so', # curl
mq_file_path + '/gskit8/lib64/libgsk8valn_64.so',
]),
('lib/ibm-mq/gskit8/lib64/N/icc/icclib', [
mq_file_path + '/gskit8/lib64/N/icc/icclib/ICCSIG.txt',
mq_file_path + '/gskit8/lib64/N/icc/icclib/libicclib085.so', # curl
]),
]

if not mq_file_path and os.environ.get('CI', '') == '':
raise Exception(
"Use the MQ_FILE_PATH environment variable to identify "
"the path where IBM MQ C redistributables are located.")

if not mq_file_path:
# We are in the CI environment, so just build a noop package.
setup()
else:
setup(
data_files=data_files,
ext_modules=[Extension(
"mqcredist",
sources=["mqcredist.c"],
define_macros=[("Py_LIMITED_API", "0x03090000")],
py_limited_api=True,
)],
options={"bdist_wheel": {"py_limited_api": "cp39"}},
)
33 changes: 33 additions & 0 deletions docs/Release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Release

GitHub Action is used to build the release files and publish them on PyPi.
This is automatically triggered when a new tag is created.


## Pre-release steps

* Create a new branch with a name that starts with `release-`.
Ex: `release-2.1.0`
* Update the version inside setup.py
* Update CHANGELOG.md with the latest version and release date.
Add a note to the IBM MQ C Redistributables version used for this release.
* Create a pull request and make sure all checks pass.
The wheels are generated as part of the PR checks,
but they are not yet published to PyPI.


## Release steps

* Use [GitHub Release](https://github.com/ibm-messaging/mq-mqi-python/releases/new) to create a new release together with a new tag.
* You don't have to create a GitHub Release, the important part is to
create a new tag.
* The tag value is the version. Without any prefix.
* Once a tag is pushed to the repo, GitHub Action will re-run all the jobs
and will publish to PyPI.


## Post-release steps

* Update the version inside setup.py to the next development version.
Increment the micro version and add a .dev0 suffix.
* Merge the pull request
Loading