Skip to content

Commit

Permalink
.github/workflows scripts/gh_release.py: treat pyodide more like othe…
Browse files Browse the repository at this point in the history
…r wheels.

.github/workflows/test_mupdf-master-branch.yml
.github/workflows/test_mupdf-release-branch.yml
    Also build pyodide wheel.
scripts/gh_release.py
    Don't special-case pyodide - we used to build with mupdf master branch if
    run as a scheduled Github action.
  • Loading branch information
julian-smith-artifex-com committed Oct 8, 2024
1 parent a73711a commit 4528c45
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test_mupdf-master-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
inputs_wheels_cps: "cp312* cp313*"
inputs_wheels_default: "0"
inputs_wheels_linux_auto: "1"
inputs_wheels_linux_pyodide: "1"
inputs_wheels_macos_auto: "1"
inputs_wheels_windows_auto: "1"
run:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_mupdf-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
inputs_wheels_cps: "cp312*"
inputs_wheels_default: "0"
inputs_wheels_linux_auto: "1"
inputs_wheels_linux_pyodide: "1"
inputs_wheels_macos_auto: "1"
inputs_wheels_windows_auto: "1"
run:
Expand Down
42 changes: 16 additions & 26 deletions scripts/gh_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

'''
Build+test script for PyMuPDF using cibuildwheel. Mostly for use with github
builds but can also be used to build Pyodide wheels.
builds.
We run cibuild manually, in order to build and test the two wheel
flavours that make up PyMuPDF:
We run cibuild manually, in order to build and test PyMuPDF wheels.
As of 2024-10-08 we also support the old two wheel flavours that make up
PyMuPDF:
PyMuPDFb
Not specific to particular versions of Python. Contains shared
Expand All @@ -16,7 +18,7 @@
Args:
build
Build using cibuild.
Build using cibuildwheel.
build-devel
Build using cibuild with `--platform` set.
pip_install <prefix>
Expand All @@ -28,26 +30,26 @@
test
Internal.
We also look at specific items in the environment, should be unset (treated as
'0'), '0' or '1'. We use environment variables here to allow use with Github
We also look at specific items in the environment. This allows use with Github
action inputs, which can't be easily translated into command-line arguments.
inputs_flavours
If unset or '1', build separate PyMuPDF and PyMuPDFb wheels.
If '0', build complete PyMuPDF wheels.
If '0' or unset, build complete PyMuPDF wheels.
If '1', build separate PyMuPDF and PyMuPDFb wheels.
inputs_sdist
inputs_skeleton
Build minimal wheel; for testing only.
inputs_wheels_cps:
Python versions to build for. E.g. 'cp38* cp312*'.
Python versions to build for. E.g. 'cp39* cp313*'.
inputs_wheels_default
Default value for other inputs_wheels_*.
Default value for other inputs_wheels_* if unset.
inputs_wheels_linux_aarch64
inputs_wheels_linux_auto
inputs_wheels_linux_pyodide
inputs_wheels_macos_arm64
inputs_wheels_macos_auto
inputs_wheels_windows_auto
If '1' we build the relevant wheels.
inputs_PYMUPDF_SETUP_MUPDF_BUILD
Used to directly set PYMUPDF_SETUP_MUPDF_BUILD.
E.g. 'git:--recursive --depth 1 --shallow-submodules --branch master https://github.com/ArtifexSoftware/mupdf.git'
Expand All @@ -60,14 +62,8 @@
Building for Pyodide
If GITHUB_EVENT_NAME is 'schedule' we assume we are running as a scheduled
Github workflow, and if inputs_PYMUPDF_SETUP_MUPDF_BUILD is unset we change
it to use MuPDF master branch.
If `inputs_wheels_linux_pyodide` is true and we are on Linux, we clone
`emsdk.git`, set it up, and run `pyodide build`. This runs our setup.py
with CC etc set up to create Pyodide binaries in a wheel called, for
example, `PyMuPDF-1.23.2-cp311-none-emscripten_3_1_32_wasm32.whl`.
If `inputs_wheels_linux_pyodide` is true and we are on Linux, we build a
Pyodide wheel, using scripts/test.py.
Set up for use outside Github
Expand Down Expand Up @@ -225,14 +221,8 @@ def get_bool(name, default=0):
# Build Pyodide wheel if specified.
#
if platform.system() == 'Linux' and inputs_wheels_linux_pyodide:
# In scheduled runs (by .github/workflows/test_pyodide.yml), use MuPDF
# master.
GITHUB_EVENT_NAME = os.getenv('GITHUB_EVENT_NAME')
if GITHUB_EVENT_NAME == 'schedule':
if inputs_PYMUPDF_SETUP_MUPDF_BUILD in ('', None):
log(f'Overriding inputs_PYMUPDF_SETUP_MUPDF_BUILD because {GITHUB_EVENT_NAME=} {inputs_PYMUPDF_SETUP_MUPDF_BUILD=}.')
inputs_PYMUPDF_SETUP_MUPDF_BUILD = 'git:--branch master https://github.com/ArtifexSoftware/mupdf.git'
log(f'{inputs_PYMUPDF_SETUP_MUPDF_BUILD=}')
# Pyodide wheels are built by running scripts/test.py, not
# cibuildwheel.
command = f'{sys.executable} scripts/test.py'
if inputs_PYMUPDF_SETUP_MUPDF_BUILD:
command += f' -m {shlex.quote(inputs_PYMUPDF_SETUP_MUPDF_BUILD)}'
Expand Down

0 comments on commit 4528c45

Please sign in to comment.