From c6a44e57e58fe20ce2b8d0db303af2eaad0bec79 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Sat, 26 Sep 2026 15:48:38 -0700 Subject: [PATCH 1/2] build: Rebuild kerf-init whenever the package is built pip install . packaged whatever kerf-init was already in src/kerf/data, since poetry only collects files and nothing ran make. A tree updated by git pull kept its old gitignored binary, and a spawn booted with it came up without the exec server, so kerf exec was refused. Run make init as the poetry build script so every wheel and editable install carries a kerf-init built from the current sources. The sdist now ships the C sources instead of a prebuilt binary. Signed-off-by: Cong Wang --- README.md | 4 +++- build.py | 21 +++++++++++++++++++++ pyproject.toml | 10 +++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 build.py diff --git a/README.md b/README.md index 2ab0960..c0792c2 100644 --- a/README.md +++ b/README.md @@ -322,7 +322,9 @@ pip install kerf-multikernel # Or isolated with pipx, avoiding conflicts with other packages pipx install kerf-multikernel -# From source (recommended for development) +# From source (recommended for development). Installing builds the +# static kerf-init with musl-gcc (e.g. apt install musl-tools), so +# rerunning pip install after a pull also picks up kerf-init changes. git clone https://github.com/multikernel/kerf.git cd kerf # Installs 'kerf' command to ~/.local/bin/kerf diff --git a/build.py b/build.py new file mode 100644 index 0000000..cc95756 --- /dev/null +++ b/build.py @@ -0,0 +1,21 @@ +# Copyright 2026 Multikernel Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Poetry build script: rebuild kerf-init so a wheel never ships a stale one. +""" + +import subprocess + +subprocess.run(["make", "init"], check=True) diff --git a/pyproject.toml b/pyproject.toml index d2cd7e6..2ef6a24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,9 +10,17 @@ authors = ["Cong Wang"] readme = "README.md" packages = [{include = "kerf", from = "src"}] include = [ - { path = "src/kerf/data/kerf-init", format = ["sdist", "wheel"] }, + { path = "src/kerf/data/kerf-init", format = ["wheel"] }, + { path = "Makefile", format = ["sdist"] }, + { path = "src/init/Makefile", format = ["sdist"] }, + { path = "src/init/*.c", format = ["sdist"] }, + { path = "src/init/*.h", format = ["sdist"] }, ] +[tool.poetry.build] +script = "build.py" +generate-setup-file = false + [tool.poetry.dependencies] python = "^3.9" pylibfdt = "^1.7.0" From 88120fb883f41cf139baa40f2a03930bc17af640 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Sat, 26 Sep 2026 15:50:03 -0700 Subject: [PATCH 2/2] release: Publish a wheel PyPI accepts now that the build compiles With kerf-init built by the poetry build script, poetry tags the wheel cp311-cp311-linux_x86_64, which PyPI rejects and which would also limit it to one Python version. kerf-init is static and is the only native code, so retag the wheel py3-none for manylinux2014 and musllinux, after checking the binary is static and letting auditwheel confirm it links no system libraries. Also build a wheel from the sdist, which now ships the C sources in place of the binary, and drop the separate make step the build script replaces. Signed-off-by: Cong Wang --- .github/workflows/release.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a3f6763..cb44e90 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,14 +35,26 @@ jobs: sudo apt-get update sudo apt-get install -y musl-tools - - name: Build init binary - run: | - make - - name: Build sdist and wheel run: | poetry build + # The build script makes the wheel interpreter and platform specific + # (cp311-cp311-linux_x86_64), which PyPI rejects. The only native code + # is the static kerf-init, so the wheel runs on any Python 3 and libc. + - name: Retag wheel for PyPI + run: | + file src/kerf/data/kerf-init | grep -q "statically linked" + pip install wheel auditwheel + python -m wheel tags --remove --python-tag py3 --abi-tag none \ + --platform-tag manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64 \ + dist/*.whl + auditwheel show dist/*.whl + + - name: Check the sdist builds a wheel + run: | + pip wheel --no-deps -w /tmp/sdist-wheel dist/*.tar.gz + - name: Upload distributions uses: actions/upload-artifact@v4 with: