0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-09-20 15:49:39 +00:00
Files
Robert Kirkman f8f800802d bump(scripts/build/setup/termux_setup_python_pip): setuptools 78.1.0, wheel 0.46.1 (#24213)
- `wheel` version 0.46+ now requires `setuptools` version 70 or newer
  - discussed upstream here: pypa/wheel#660
  - discovered in termux-packages here: termux#24062 (comment)

- Lock `wheel` version at 0.46.1 so that if a future `wheel` update causes a similar problem in the future, it doesn't immediately propagate into termux-packages without us explicitly bumping it. Recommended by Tomjo2000 here: termux#24062 (comment)

- I have confirmed that this change works to fix the build of `python-lxml` **both**
  - **in `TERMUX_ON_DEVICE_BUILD=false` mode (broken temporarily for 1 week)**,
    - fixes `error: invalid command 'bdist_wheel'`
  - **and also in `TERMUX_ON_DEVICE_BUILD=true` mode (broken for 6 months)**.
    - fixes `ModuleNotFoundError: No module named 'setuptools'`

- It seems appropriate to remove the `if [ "${TERMUX_PYTHON_VERSION#*.}" -lt "12" ]` block because there is no longer any `python3.11` so it does not seem like that code is reachable anymore.

- `python-torchvision` needed ajustment of its custom `CFLAGS` to be `CXXFLAGS` instead, because the newer `setuptools` is now compiling it using `aarch64-linux-android-clang++` instead of `aarch64-linux-android-clang`.

- `python-pip` and `python-pillow` both had locked `setuptools` in their `TERMUX_PKG_PYTHON_COMMON_DEPS` at versions slightly newer than the old global version, now that the global version is newer than either of those, they do not seem to need that anymore.
2025-04-13 23:39:15 +02:00

42 lines
1.6 KiB
Bash

TERMUX_PKG_HOMEPAGE=https://github.com/pytorch/vision
TERMUX_PKG_DESCRIPTION="Datasets, Transforms and Models specific to Computer Vision"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.21.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/pytorch/vision/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=0a4a967bbb7f9810f792cd0289a07fb98c8fb5d1303fae8b63e3a6b05d720058
TERMUX_PKG_DEPENDS="libc++, ffmpeg, python, python-numpy, python-pillow, python-pip, python-torch, libjpeg-turbo, libpng, libwebp, zlib"
TERMUX_PKG_SETUP_PYTHON=true
termux_step_pre_configure() {
CXXFLAGS+=" -I${TERMUX_PYTHON_HOME}/site-packages/torch/include"
CXXFLAGS+=" -I${TERMUX_PYTHON_HOME}/site-packages/torch/include/torch/csrc/api/include"
CXXFLAGS+=" -DUSE_PYTHON"
LDFLAGS+=" -ltorch_cpu -ltorch_python -lc10"
# setting this $BUILD_PREFIX variable, which wasn't previously set, causes
# libwebp to be detected and libjpeg to be detected,
# and assists with detecting ffmpeg
export BUILD_PREFIX="$TERMUX_PREFIX"
export BUILD_VERSION=$TERMUX_PKG_VERSION
# this causes ffmpeg to be detected during cross-compilation,
# enabling the "video decoder extensions"
sed -i "s|shutil.which(\"ffmpeg\")|\"$TERMUX_PREFIX/bin/ffmpeg\"|" setup.py
}
termux_step_configure() {
:
}
termux_step_make_install() {
pip -v install --no-build-isolation --no-deps --prefix "$TERMUX_PREFIX" "$TERMUX_PKG_SRCDIR"
}
termux_step_create_debscripts() {
echo "#!$TERMUX_PREFIX/bin/sh" > postinst
echo "echo 'Installing dependencies for $TERMUX_PKG_NAME...'" >> postinst
echo "pip3 install torchvision" >> postinst
}