Skip to content

Commit fc5fee0

Browse files
committed
more wheels, bump libunwind
1 parent 155d4ba commit fc5fee0

File tree

3 files changed

+69
-65
lines changed

3 files changed

+69
-65
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -228,51 +228,64 @@ jobs:
228228
run: |
229229
docker buildx imagetools inspect ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}
230230
231-
pip-build:
232-
name: Build distribution 📦
233-
runs-on: ubuntu-latest
231+
build_wheels:
232+
name: Build wheels on ${{ matrix.os }}
233+
runs-on: ${{ matrix.os }}
234+
strategy:
235+
matrix:
236+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-14]
234237

235238
steps:
236-
- uses: actions/checkout@v4
237-
with:
238-
persist-credentials: false
239-
- name: Set up Python
240-
uses: actions/setup-python@v5
241-
with:
242-
python-version: "3.10"
243-
- name: Install pypa/build
244-
run: >-
245-
python3 -m
246-
pip install
247-
build
248-
--user
249-
- name: Build a binary wheel and a source tarball
250-
run: python3 -m build
251-
- name: Store the distribution packages
252-
uses: actions/upload-artifact@v4
253-
with:
254-
name: python-package-distributions
255-
path: dist/
256-
257-
publish-to-pypi:
258-
name: >-
259-
Publish Python 🐍 distribution 📦 to PyPI
260-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
261-
needs:
262-
- pip-build
239+
- uses: actions/checkout@v4
240+
241+
# Used to host cibuildwheel
242+
- uses: actions/setup-python@v5
243+
244+
- name: Install cibuildwheel
245+
run: python -m pip install cibuildwheel==3.0.0b1
246+
247+
- name: Build wheels
248+
run: python -m cibuildwheel --output-dir wheelhouse
249+
env:
250+
CIBW_BUILD: "cp310-*"
251+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
252+
253+
- uses: actions/upload-artifact@v4
254+
with:
255+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
256+
path: ./wheelhouse/*.whl
257+
258+
build_sdist:
259+
name: Build source distribution
263260
runs-on: ubuntu-latest
264-
environment:
265-
name: pypi
266-
url: https://pypi.org/p/pyda-dbi # Replace <package-name> with your PyPI project name
267-
permissions:
268-
id-token: write # IMPORTANT: mandatory for trusted publishing
269261
steps:
270-
- name: Download all the dists
271-
uses: actions/download-artifact@v4
272-
with:
273-
name: python-package-distributions
274-
path: dist/
275-
- name: Publish distribution 📦 to PyPI
276-
uses: pypa/gh-action-pypi-publish@release/v1
262+
- uses: actions/checkout@v4
263+
264+
- name: Build sdist
265+
run: pipx run build --sdist
277266

267+
- uses: actions/upload-artifact@v4
268+
with:
269+
name: cibw-sdist
270+
path: dist/*.tar.gz
278271

272+
upload_pypi:
273+
needs: [build_wheels, build_sdist]
274+
runs-on: ubuntu-latest
275+
environment: pypi
276+
permissions:
277+
id-token: write
278+
if: github.event_name == 'release' && github.event.action == 'published'
279+
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
280+
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
281+
steps:
282+
- uses: actions/download-artifact@v4
283+
with:
284+
# unpacks all CIBW artifacts into dist/
285+
pattern: cibw-*
286+
path: dist
287+
merge-multiple: true
288+
289+
- uses: pypa/gh-action-pypi-publish@release/v1
290+
with:
291+
repository-url: https://test.pypi.org/legacy/

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
requires-python = "== 3.10"
2+
requires-python = ">=3.10,<3.11"
33
dynamic = ["version"]
44
name = "pyda-dbi"
55

@@ -8,6 +8,7 @@ requires = [
88
"setuptools>=64",
99
"cmake>=3.18",
1010
"setuptools-scm>=8",
11+
"wget"
1112
]
1213
build-backend = "setuptools.build_meta"
1314

setup.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import multiprocessing
1313
import platform
1414
import site
15+
from urllib.request import urlretrieve
1516

1617
def dynamorio_tag_and_patch():
1718
if "macOS" in platform.platform():
@@ -25,30 +26,17 @@ def run_command(command, cwd=None, env=None):
2526
subprocess.check_call(command, cwd=cwd, env=env)
2627

2728
def download_and_extract(url, extract_dir):
28-
import urllib.request
2929
import tarfile
3030

3131
filename = url.split('/')[-1]
32-
urllib.request.urlretrieve(url, filename)
32+
urlretrieve(url, filename)
3333

3434
with tarfile.open(filename) as tar:
3535
tar.extractall(path=extract_dir)
3636

3737
os.remove(filename)
3838

39-
class CustomBuildCommand(Command):
40-
description = "Build Pyda"
41-
user_options = []
42-
43-
def initialize_options(self):
44-
self.build_temp = None
45-
self.build_lib = None
46-
47-
def finalize_options(self):
48-
self.set_undefined_options('build',
49-
('build_temp', 'build_temp'),
50-
('build_lib', 'build_lib'))
51-
39+
class CustomBuildCommand(build_ext):
5240
def run(self):
5341
# Create temporary build directory
5442
build_temp_dir = tempfile.TemporaryDirectory()
@@ -68,10 +56,10 @@ def run(self):
6856
libunwind_dir = os.path.join(build_temp, 'libunwind')
6957
os.makedirs(libunwind_dir, exist_ok=True)
7058
download_and_extract(
71-
'https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz',
59+
'https://github.com/libunwind/libunwind/releases/download/v1.8.1/libunwind-1.8.1.tar.gz',
7260
libunwind_dir
7361
)
74-
libunwind_build_dir = os.path.join(libunwind_dir, 'libunwind-1.6.2')
62+
libunwind_build_dir = os.path.join(libunwind_dir, 'libunwind-1.8.1')
7563
run_command(['./configure', f'--prefix={os.path.abspath(libunwind_install_dir)}'], cwd=libunwind_build_dir)
7664
run_command(['make', f'-j{multiprocessing.cpu_count()}'], cwd=libunwind_build_dir)
7765
run_command(['make', 'install'], cwd=libunwind_build_dir)
@@ -92,8 +80,11 @@ def run(self):
9280
if os.path.exists(patch_path):
9381
run_command(['git', 'apply', patch_path], cwd=dynamorio_dir)
9482

95-
run_command(["bash", "-c", "wget https://github.com/DynamoRIO/dynamorio/commit/f1b67a4b0cf0a13314d500dd3aaefe9869597021.patch && git apply f1b67a4b0cf0a13314d500dd3aaefe9869597021.patch && rm f1b67a4b0cf0a13314d500dd3aaefe9869597021.patch && git submodule update --init"], cwd=dynamorio_dir)
96-
run_command(["bash", "-c", "wget https://github.com/DynamoRIO/dynamorio/commit/c46d736f308e6e734bd0477f7b8a2dcbefb155d3.patch && git apply c46d736f308e6e734bd0477f7b8a2dcbefb155d3.patch && rm c46d736f308e6e734bd0477f7b8a2dcbefb155d3.patch"], cwd=dynamorio_dir)
83+
urlretrieve('https://github.com/DynamoRIO/dynamorio/commit/f1b67a4b0cf0a13314d500dd3aaefe9869597021.patch', os.path.join(dynamorio_dir, 'f1b67a4b0cf0a13314d500dd3aaefe9869597021.patch'))
84+
urlretrieve('https://github.com/DynamoRIO/dynamorio/commit/c46d736f308e6e734bd0477f7b8a2dcbefb155d3.patch', os.path.join(dynamorio_dir, 'c46d736f308e6e734bd0477f7b8a2dcbefb155d3.patch'))
85+
86+
run_command(["bash", "-c", "git apply f1b67a4b0cf0a13314d500dd3aaefe9869597021.patch && rm f1b67a4b0cf0a13314d500dd3aaefe9869597021.patch && git submodule update --init"], cwd=dynamorio_dir)
87+
run_command(["bash", "-c", "git apply c46d736f308e6e734bd0477f7b8a2dcbefb155d3.patch && rm c46d736f308e6e734bd0477f7b8a2dcbefb155d3.patch"], cwd=dynamorio_dir)
9788

9889
# Build DynamoRIO
9990
dynamorio_build_dir = os.path.join(dynamorio_dir, 'build')
@@ -184,7 +175,6 @@ def run(self):
184175
# Custom install command that runs our build command first
185176
class CustomInstallCommand(install):
186177
def run(self):
187-
self.run_command('build_pyda')
188178
install.run(self)
189179
prepend_env = f"""
190180
BASE=$(python3 -c "from importlib.resources import files; print(files('pyda'))" 2>/dev/null)
@@ -232,7 +222,6 @@ def run(self):
232222
# Custom develop command that runs our build command first
233223
class CustomDevelopCommand(develop):
234224
def run(self):
235-
self.run_command('build_pyda')
236225
develop.run(self)
237226

238227
setup(
@@ -241,7 +230,7 @@ def run(self):
241230
author='Andrew Haberlandt',
242231
author_email='[email protected]',
243232
cmdclass={
244-
'build_pyda': CustomBuildCommand,
233+
'build_ext': CustomBuildCommand,
245234
'install': CustomInstallCommand,
246235
'develop': CustomDevelopCommand,
247236
},
@@ -260,5 +249,6 @@ def run(self):
260249
# Add your Python package dependencies here
261250
],
262251
scripts=[],
252+
ext_modules=[Extension("dummy", sources=[])],
263253
)
264254

0 commit comments

Comments
 (0)