Skip to content

fix release: strip License-File from wheel METADATA before uploading … #12

fix release: strip License-File from wheel METADATA before uploading …

fix release: strip License-File from wheel METADATA before uploading … #12

Workflow file for this run

name: Release Linux wheels
on:
push:
branches: ["master"]
jobs:
build:
name: Build manylinux wheels (${{ matrix.arch }})
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU (for aarch64)
if: matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.22
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_BEFORE_BUILD: pip install setuptools numpy cython build
CIBW_BUILD_FRONTEND: "build; args: --wheel --no-isolation"
CIBW_TEST_COMMAND: python -c "import mdfreader"
- uses: actions/upload-artifact@v4
with:
name: wheel-linux-${{ matrix.arch }}
path: wheelhouse/*.whl
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheel-linux-*
merge-multiple: true
path: dist/
- name: Strip License-File from wheel metadata
run: |
python - <<'EOF'
import zipfile, os
for whl in os.listdir('dist'):
if not whl.endswith('.whl'): continue
path = os.path.join('dist', whl)
tmp = path + '.tmp'
with zipfile.ZipFile(path, 'r') as zin, zipfile.ZipFile(tmp, 'w', compression=zipfile.ZIP_DEFLATED) as zout:
for item in zin.infolist():
data = zin.read(item.filename)
if item.filename.endswith('/METADATA') or item.filename.endswith('.dist-info/METADATA'):
data = b'\n'.join(l for l in data.split(b'\n') if not l.lower().startswith(b'license-file:'))
zout.writestr(item, data)
os.replace(tmp, path)
EOF
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
pip install twine
twine upload dist/* --skip-existing