forked from teebr/socketsocketcan
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use "uv" to compile wheels for more armv7l platforms
I use the buster image, so the wheels should be compatible with any newer distro as well
- Loading branch information
Showing
2 changed files
with
28 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
ARG APP_IMAGE=balenalib/armv7hf-debian:stretch | ||
ARG APP_IMAGE=balenalib/armv7hf-debian:buster | ||
FROM $APP_IMAGE | ||
|
||
ARG PYTHON_VERSION=3.7 | ||
|
||
ENV UV_PYTHON="$PYTHON_VERSION" | ||
ENV UV_SYSTEM_PYTHON=1 | ||
|
||
COPY . /socketsocketcan | ||
|
||
RUN [ "cross-build-start" ] | ||
|
||
# Install uv. | ||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv | ||
|
||
# Get dependencies. | ||
RUN apt-get -y update | ||
RUN apt-get -y install apt-utils | ||
RUN apt-get -y install build-essential python3-dev python3-pip | ||
RUN apt-get -y install build-essential clang python3-dev python3-pip | ||
RUN rm /usr/lib/python3.*/EXTERNALLY-MANAGED || true | ||
RUN python3 -m pip install --extra-index-url=https://www.piwheels.org/simple -U pip setuptools wheel pybind11 | ||
|
||
# Install Python using uv if it is not the native one. | ||
RUN if ! uv python find "$PYTHON_VERSION" >/dev/null 2>&1; then \ | ||
uv python install "$PYTHON_VERSION" \ | ||
else \ | ||
python3 -m pip install --extra-index-url=https://www.piwheels.org/simple -U pip setuptools wheel \ | ||
fi | ||
|
||
# Install Python dependencies. | ||
RUN uv pip install --extra-index-url=https://www.piwheels.org/simple pybind11 | ||
|
||
# Build the wheel. | ||
RUN python3 -m pip -v wheel --wheel-dir=/socketsocketcan-wheel /socketsocketcan | ||
RUN uv build --wheel --out-dir=/socketsocketcan-wheel /socketsocketcan | ||
|
||
# Make sure the wheel is working. | ||
RUN python3 -m pip install --no-index --find-links=/socketsocketcan-wheel socketsocketcan | ||
RUN python3 -c "import socketsocketcan; print(dir(socketsocketcan))" | ||
RUN uv pip install --no-index --find-links=/socketsocketcan-wheel socketsocketcan | ||
RUN uv run -- python -c "import socketsocketcan; print(dir(socketsocketcan))" | ||
|
||
RUN [ "cross-build-end" ] |