1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
[]
= ["hatchling"]
= "hatchling.build"
[]
= "medius"
= "3.4.6"
= "Python bindings for Medius, replacement firmware for the MAKCU box"
= "README.md"
= ">=3.8"
= { = "MIT" }
= [{ = "medius" }]
= ["medius", "mouse", "hid", "serial", "makcu"]
= [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Rust",
"Topic :: System :: Hardware",
]
[]
= "https://medius.k4tech.net"
= "https://medius.k4tech.net/bindings/python"
= "https://github.com/K4HVH/medius"
= "https://discord.gg/ArRqcA84pB"
[]
= ["pytest"]
[]
= ["medius"]
# The bundled cdylib makes this platform-specific, but ctypes doesn't link the
# CPython ABI; the build hook tags the wheel py3-none-<platform>.
= false
# The build hook below builds and copies in the cdylib.
= [
"medius/libmedius_capi.so",
"medius/libmedius_capi.dylib",
"medius/medius_capi.dll",
]
# Global, so it runs for the wheel build (cargo, bundle, tag) and the sdist build
# (vendor the Rust sources under _rust/ for a self-contained build).
[]
= "hatch_build.py"
[]
# The build hook vendors the Rust workspace under _rust/, so the sdist builds
# without the rest of the repo (cibuildwheel builds from it). These entries are
# the Python package.
= ["medius", "hatch_build.py", "pyproject.toml"]
# --- cibuildwheel ---
# Build from the self-contained sdist; each wheel bundles its cdylib, so
# `pip install medius` needs no Rust toolchain. The build hook runs
# `cargo build --release -p medius-capi` from the vendored sources, so
# before-all installs Rust. Arch is the runner's (one CI runner per arch).
[]
# The wheel is tagged py3-none-<platform>, so one interpreter per platform builds
# a wheel for every supported Python 3.x. The five platforms mirror the C ABI
# tarballs: glibc Linux x86_64/aarch64 (manylinux), macOS arm64 and x86_64, and
# 64-bit Windows. musllinux, win32 and i686 Linux have no toolchain set up and
# build from the sdist.
= "cp310-manylinux_* cp310-macosx_* cp310-win_amd64"
= "build"
# The bundled wheel has no mock feature, so only smoke-test the import; the
# python CI job runs the mock-backed suite against a debug build.
= "python -c \"import medius; print(medius.abi_version(), medius.version_string())\""
[]
# 64-bit only: cibuildwheel's default Linux archs include i686, which we don't ship.
= "auto64"
# The cdylib links libudev (via serialport); the manylinux container lacks it and
# Rust (the mac/windows runners ship Rust, so they skip this).
= "(yum install -y systemd-devel pkgconfig || dnf install -y systemd-devel pkgconfig) && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal"
= { = "$HOME/.cargo/bin:$PATH" }
[]
# Both arches: the arm64 runner cross-builds the x86_64 wheel (see hatch_build.py).
= "x86_64 arm64"
# rustc's macOS floor is 10.12 (x86_64) / 11.0 (arm64); cibuildwheel defaults
# x86_64 to 10.9, so the cross-built dylib (>=10.12) and the wheel disagree and
# delocate (which reads this env) rejects it. 11.0 satisfies both arches. This
# MUST be set here, not just in the build hook, so the repair step sees it too.
= { = "11.0" }
# The runner already ships rust; just add the cross target so the arm64 runner
# can also build the x86_64 wheel.
= "rustup target add x86_64-apple-darwin aarch64-apple-darwin"