Skip to content

Commit 8fed448

Browse files
committed
Trigger testpypi publish 3.2.6.8
1 parent 754da16 commit 8fed448

4 files changed

Lines changed: 22 additions & 19 deletions

File tree

.github/workflows/bld_wheels_and_upload.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
CIBW_BUILD: "*-win_amd64"
2828
CIBW_SKIP: "cp38-*"
2929

30+
- name: Inject ibm_db_dll.pth into wheels
31+
run: python scripts/inject_pth_into_wheel.py wheelhouse
32+
3033
- uses: actions/upload-artifact@v4.4.3
3134
with:
3235
name: ibmdb-wheels64-${{ matrix.os }}
@@ -47,6 +50,9 @@ jobs:
4750
CIBW_BUILD: "*-win32"
4851
CIBW_SKIP: "cp38-*"
4952

53+
- name: Inject ibm_db_dll.pth into wheels
54+
run: python scripts/inject_pth_into_wheel.py wheelhouse
55+
5056
- uses: actions/upload-artifact@v4.4.3
5157
with:
5258
name: ibmdb-wheels32-${{ matrix.os }}

ibm_db.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
+--------------------------------------------------------------------------+
2323
*/
2424

25-
#define MODULE_RELEASE "3.2.6.7"
25+
#define MODULE_RELEASE "3.2.6.8"
2626

2727
#include <Python.h>
2828
#include <datetime.h>

scripts/inject_pth_into_wheel.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
PTH_FILENAME = 'ibm_db_dll.pth'
1212
PTH_CONTENT = 'import _ibm_db_register_dll\n'
13-
REGISTER_MODULE = '_ibm_db_register_dll.py'
1413

1514

1615
def _record_line(name, content_bytes):
@@ -21,43 +20,42 @@ def _record_line(name, content_bytes):
2120

2221

2322
def inject_pth(whl_path):
24-
"""Add ibm_db_dll.pth and _ibm_db_register_dll.py to a wheel file."""
25-
# Skip if already injected
23+
"""Add ibm_db_dll.pth to a wheel file and remove any misplaced copies."""
2624
with zipfile.ZipFile(whl_path, 'r') as zin:
27-
if PTH_FILENAME in zin.namelist():
28-
print(f' {PTH_FILENAME} already in {os.path.basename(whl_path)}, skipping')
25+
names = zin.namelist()
26+
# Skip if the .pth file is already at the wheel root
27+
if PTH_FILENAME in names:
28+
print(f' {PTH_FILENAME} already at root of {os.path.basename(whl_path)}, skipping')
2929
return
3030

31-
# Read the register module from the repo root
32-
register_module_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), REGISTER_MODULE)
33-
with open(register_module_path, 'rb') as f:
34-
register_bytes = f.read()
35-
3631
tmp_fd, tmp_path = tempfile.mkstemp(suffix='.whl')
3732
os.close(tmp_fd)
3833

3934
pth_bytes = PTH_CONTENT.encode('utf-8')
4035
pth_record = _record_line(PTH_FILENAME, pth_bytes)
41-
register_record = _record_line(REGISTER_MODULE, register_bytes)
4236

4337
with zipfile.ZipFile(whl_path, 'r') as zin, \
4438
zipfile.ZipFile(tmp_path, 'w', zipfile.ZIP_DEFLATED) as zout:
4539

4640
for item in zin.infolist():
41+
# Drop any misplaced copies of the .pth file (absolute-path junk from data_files)
42+
if item.filename != PTH_FILENAME and item.filename.endswith('/' + PTH_FILENAME):
43+
print(f' Removing misplaced {item.filename}')
44+
continue
45+
4746
data = zin.read(item.filename)
4847

49-
# Append our entries to the RECORD file
48+
# Append our .pth entry to the RECORD file
5049
if item.filename.endswith('/RECORD'):
51-
data = data.rstrip(b'\n') + b'\n' + pth_record.encode('utf-8') + b'\n' + register_record.encode('utf-8') + b'\n'
50+
data = data.rstrip(b'\n') + b'\n' + pth_record.encode('utf-8') + b'\n'
5251

5352
zout.writestr(item, data)
5453

55-
# Add the .pth file and register module at the wheel root
54+
# Add the .pth file at the wheel root
5655
zout.writestr(PTH_FILENAME, pth_bytes)
57-
zout.writestr(REGISTER_MODULE, register_bytes)
5856

5957
shutil.move(tmp_path, whl_path)
60-
print(f' Injected {PTH_FILENAME} and {REGISTER_MODULE} into {os.path.basename(whl_path)}')
58+
print(f' Injected {PTH_FILENAME} into {os.path.basename(whl_path)}')
6159

6260

6361
def main():

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,7 @@ def print_exception( e, url):
499499
data_files = [ (get_python_lib(), ['./README.md']),
500500
(get_python_lib(), ['./CHANGES.md']),
501501
(get_python_lib(), ['./LICENSE']),
502-
(get_python_lib(), ['./config.py.sample']),
503-
(get_python_lib(), ['./ibm_db_dll.pth'])]
502+
(get_python_lib(), ['./config.py.sample'])]
504503

505504
modules = ['ibm_db_dbi', 'testfunctions', 'ibmdb_tests', 'ibm_db_ctx', '_ibm_db_register_dll']
506505

0 commit comments

Comments
 (0)