Skip to content

Commit 5b5ba42

Browse files
committed
Fix pypi upload, linux pip tag, and bdist warn
1 parent 1edd054 commit 5b5ba42

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,15 @@ jobs:
280280
permissions:
281281
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
282282
steps:
283-
- uses: actions/download-artifact@v4
283+
- uses: actions/download-artifact@v5
284284
with:
285-
merge-multiple: true
285+
path: artifacts
286+
287+
- name: List artifacts
288+
run: find artifacts/
286289

287290
- name: Make dist directory
288-
run: mkdir dist && cp wheels/* sdist/* dist/
291+
run: mkdir dist && cp artifacts/wheels-*/* artifacts/sdist/* dist/
289292

290293
- name: Publish package distributions to PyPI
291294
uses: pypa/gh-action-pypi-publish@release/v1

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ include HISTORY.md
22
include src/py_mini_racer/icudtl.dat
33
include src/py_mini_racer/*.so
44
include src/py_mini_racer/*.dll
5+
include src/py_mini_racer/*.dylib

setup.py

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

33
from pathlib import Path
4-
from platform import machine
5-
from sys import platform
64

75
from packaging.tags import platform_tags
86
from setuptools import setup
@@ -15,16 +13,26 @@ def _get_platform_tag() -> str:
1513
See https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/.
1614
"""
1715

18-
if platform == "darwin":
16+
# generally return the first, meaning the most-specific, platform tag:
17+
tag = next(platform_tags())
18+
19+
if tag.startswith("macos_"):
1920
# pip seems finicky about platform tags with larger macos versions, so just
2021
# tell arm64 is 11.0 and everything is is 10.9:
21-
if machine() == "arm64":
22+
if tag.endswith("_arm64"):
2223
return "macosx_11_0_arm64"
2324

2425
return "macosx_10_9_x86_64"
2526

26-
# return the first, meaning the most-specific, platform tag:
27-
return next(platform_tags())
27+
if tag.startswith("manylinux_"):
28+
# The v8 build process bundles its own Linux sysroots which work on Linuxes at
29+
# least this old (regardless of the platform we build on):
30+
if tag.endswith("_aarch64"):
31+
return "manylinux_2_27_aarch64"
32+
33+
return "manylinux_2_27_x86_64"
34+
35+
return tag
2836

2937

3038
# From https://stackoverflow.com/questions/76450587/python-wheel-that-includes-shared-library-is-built-as-pure-python-platform-indep:
@@ -36,6 +44,31 @@ def finalize_options(self) -> None:
3644
def get_tag(self) -> tuple[str, str, str]:
3745
return "py3", "none", _get_platform_tag()
3846

47+
def run(self) -> None:
48+
mini_racer_src_dir = Path(__file__).parent / "src" / "py_mini_racer"
49+
if (
50+
not (mini_racer_src_dir / "mini_racer.dll").exists()
51+
and not (mini_racer_src_dir / "libmini_racer.so").exists()
52+
and not (mini_racer_src_dir / "libmini_racer.dylib").exists()
53+
):
54+
# PyMiniRacer does not support a traditional from-source pip build, because
55+
# the v8 build is generally very slow, fragile, has many external
56+
# dependencies (exactly *which* depends on your system), and furthermore for
57+
# many systems the only viable build option is to cross-compile from
58+
# *another* system.
59+
# The intent of PyMiniRacer project is to build for all major platforms from
60+
# the GitHub home, and publish binary wheels to pip, so that you do not need
61+
# to build the wheel from source yourself.
62+
# If you want to build PyMiniRacer, you should use PyMiniRacer's build
63+
# system, starting with `just build-dll`, on a supported platform.
64+
# If you have an architecture that PyMiniRacer does not yet provide a wheel
65+
# for, consider contributing a pull request to add it at:
66+
# https://github.com/bpcreech/PyMiniRacer.
67+
msg = "Run `just build-dll` before building a PyMiniRacer wheel."
68+
raise RuntimeError(msg)
69+
70+
super().run()
71+
3972

4073
def _generate_readme() -> str:
4174
return "\n".join(

0 commit comments

Comments
 (0)