From 07189f68bca3a0446b7520f58b5e0fadea457c87 Mon Sep 17 00:00:00 2001 From: Robert Kirkman Date: Sun, 16 Mar 2025 11:06:15 -0500 Subject: [PATCH 1/3] tree-wide: port debpython to termux - debpython is the commands `py3compile` and `py3clean` from Debian. I am calling them that because a large chunk of their source code is found inside a folder inside Debian's source code named "debpython" - https://salsa.debian.org/cpython-team/python3-defaults/-/tree/5348f704668c0b6c360b6c6fb10153b9c2898af5 - rather than packaging `.pyc` files into packages, `py3compile` and `py3clean` can be called from `postinst` and `prerm` scripts to generate all `.pyc` for the `.py` files in the package immediately after the package is installed, and remove all `.pyc` files immediately before uninstalling the package, respectively - fixes the error `trying to overwrite '/data/data/com.termux/files/usr/lib/python3.12/__pycache__/cProfile.cpython-312.pyc'` when packages were built on-device, but at the same time, also: - prevents the warnings `dpkg: warning: while removing python, directory '/data/data/com.termux/files/usr/lib/python3.12/site-packages' not empty so not removed` as long as no packages were installed using `pip` - The revision-bumps that change `control.tar.xz` (debscripts) of packages only and are not otherwise visible are omitted from this PR, and will come in a second PR afterward. - The `termux_step_create_python_debscripts.sh` can configure work on debpython (i.e. its `py3copile` and `py3clean` commands) from the glibc package `python-glibc`, if some glibc package is being compiled. - New variables have been implemented: - `TERMUX_PYTHON_CROSSENV_BUILDHOME` - location of crossenv's python build libraries. - `TERMUX_PKG_PYTHON_RUNTIME_DEPS` - configures the installation of the python modules via pip3 in the pkg's debscripts. If not configured in the package, it will use the value from `TERMUX_PKG_PYTHON_TARGET_DEPS`. If the variable is set to `false`, then the customization of installing python modules will be disabled, even if the `TERMUX_PKG_PYTHON_TARGET_DEPS` variable is set in the package. - `TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS` - configures the installation of the python modules via pip3 in the subpkg's debscripts. - Implemented reconfiguration of prefixes in python module `sysconfig` and setting in `TERMUX_PYTHON_CROSSENV_BUILDHOME`, so that python modules from crossenv building can specify system paths of termux for correct compilation. - Added automatic addition of `python-glibc{-glibc}` dependency when using the `TERMUX_PKG_PYTHON_RUNTIME_DEPS` (for pkg; will be disabled, i.e. will not be added, if the variable is set to `false`) or `TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS` (for subpkg) value. - setup-termux: - add comment and disabled dependency 'pandoc' to prepare for steps towards fixing on-device build of 'nala' - add 'python-pip' and implementation of installing 'system-wide' (Termux-wide) pip packages outside of venv in order to work towards closer accuracy of setup-termux.sh to setup-ubuntu.sh - add 'itstool' from PyPi system-wide to approximate the installation through 'apt' of 'itstool' system-wide in the Ubuntu cross-builder image Co-authored-by: Maxython --- build-package.sh | 4 + packages/python/build.sh | 32 ++- packages/python/debpython.patch | 203 ++++++++++++++++++ packages/python/python-tkinter.subpackage.sh | 1 - .../build/setup/termux_setup_python_pip.sh | 4 + .../build/termux_create_debian_subpackages.sh | 2 + .../build/termux_create_pacman_subpackages.sh | 2 + .../build/termux_step_copy_into_massagedir.sh | 2 +- .../termux_step_create_debian_package.sh | 1 + .../termux_step_create_pacman_package.sh | 1 + .../termux_step_create_python_debscripts.sh | 116 ++++++++++ .../termux_step_get_dependencies_python.sh | 4 +- scripts/build/termux_step_setup_variables.sh | 2 + scripts/build/termux_step_start_build.sh | 18 ++ scripts/buildorder.py | 12 +- scripts/setup-termux.sh | 23 ++ 16 files changed, 418 insertions(+), 9 deletions(-) create mode 100644 packages/python/debpython.patch create mode 100644 scripts/build/termux_step_create_python_debscripts.sh diff --git a/build-package.sh b/build-package.sh index e82ae641bac98a2..3c44117bbc65088 100755 --- a/build-package.sh +++ b/build-package.sh @@ -381,6 +381,10 @@ termux_step_post_massage() { # shellcheck source=scripts/build/termux_step_create_debscripts.sh source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_create_debscripts.sh" +# Function to generate debscripts for python packages. +# shellcheck source=scripts/build/termux_step_create_python_debscripts.sh +source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_create_python_debscripts.sh" + # Convert Debian maintainer scripts into pacman-compatible installation hooks. # This is used only when creating pacman packages. # shellcheck source=scripts/build/termux_step_create_pacman_install_hook.sh diff --git a/packages/python/build.sh b/packages/python/build.sh index 508e34234282e52..07058a17bbaeac9 100644 --- a/packages/python/build.sh +++ b/packages/python/build.sh @@ -4,11 +4,19 @@ TERMUX_PKG_DESCRIPTION="Python 3 programming language intended to enable clear p TERMUX_PKG_LICENSE="custom" TERMUX_PKG_LICENSE_FILE="LICENSE" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION="3.12.11" -TERMUX_PKG_SRCURL=https://www.python.org/ftp/python/${TERMUX_PKG_VERSION}/Python-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=c30bb24b7f1e9a19b11b55a546434f74e739bb4c271a3e3a80ff4380d49f7adb +TERMUX_PKG_VERSION=3.12.11 +TERMUX_PKG_REVISION=1 +_DEBPYTHON_COMMIT=5348f704668c0b6c360b6c6fb10153b9c2898af5 +TERMUX_PKG_SRCURL=( + https://www.python.org/ftp/python/${TERMUX_PKG_VERSION}/Python-${TERMUX_PKG_VERSION}.tar.xz + https://salsa.debian.org/cpython-team/python3-defaults/-/archive/${_DEBPYTHON_COMMIT}/python3-defaults-${_DEBPYTHON_COMMIT}.tar.gz +) +TERMUX_PKG_SHA256=( + c30bb24b7f1e9a19b11b55a546434f74e739bb4c271a3e3a80ff4380d49f7adb + d54ee8a27d53750a2fc13aa3c4ddc105138bcbd9b2fe77c5858a3c49e3843b66 +) TERMUX_PKG_AUTO_UPDATE=false -TERMUX_PKG_DEPENDS="gdbm, libandroid-posix-semaphore, libandroid-support, libbz2, libcrypt, libexpat, libffi, liblzma, libsqlite, ncurses, ncurses-ui-libs, openssl, readline, zlib" +TERMUX_PKG_DEPENDS="gdbm, libandroid-posix-semaphore, libandroid-support, libbz2, libcrypt, libexpat, libffi, liblzma, libsqlite, ncurses, ncurses-ui-libs, openssl, readline, zlib, termux-tools" TERMUX_PKG_BUILD_DEPENDS="tk" TERMUX_PKG_RECOMMENDS="python-ensurepip-wheels, python-pip" TERMUX_PKG_SUGGESTS="python-tkinter" @@ -56,6 +64,10 @@ lib/python${_MAJOR_VERSION}/*/tests lib/python${_MAJOR_VERSION}/site-packages/*/ " +termux_step_post_get_source() { + mv "$TERMUX_PKG_SRCDIR/python3-defaults-$_DEBPYTHON_COMMIT" "$TERMUX_PKG_SRCDIR/debpython" +} + termux_step_pre_configure() { # -O3 gains some additional performance on at least aarch64. CFLAGS="${CFLAGS/-Oz/-O3}" @@ -81,6 +93,10 @@ termux_step_pre_configure() { export LDFLAGS+=" -landroid-posix-semaphore" export LIBCRYPT_LIBS="-lcrypt" + + sed -i -e "s|@TERMUX_PYTHON_VERSION@|${_MAJOR_VERSION}|g" \ + -e "s|@TERMUX_PKG_FULLVERSION@|$(test ${TERMUX_PACKAGE_FORMAT} = pacman && echo ${TERMUX_PKG_FULLVERSION_FOR_PACMAN} || echo ${TERMUX_PKG_FULLVERSION})|g" \ + $(find "$TERMUX_PKG_SRCDIR/debpython" -type f) } termux_step_post_make_install() { @@ -91,6 +107,14 @@ termux_step_post_make_install() { ln -sf pydoc${_MAJOR_VERSION} pydoc) (cd $TERMUX_PREFIX/share/man/man1 ln -sf python${_MAJOR_VERSION}.1 python.1) + + install -m 755 -d "$TERMUX_PREFIX/lib/python$_MAJOR_VERSION/debpython" + install -m 644 "$TERMUX_PKG_SRCDIR/debpython/debpython/"* \ + "$TERMUX_PREFIX/lib/python$_MAJOR_VERSION/debpython/" + + for prog in py3compile py3clean; do + install -m 755 "$TERMUX_PKG_SRCDIR/debpython/$prog" "$TERMUX_PREFIX/bin/" + done } termux_step_post_massage() { diff --git a/packages/python/debpython.patch b/packages/python/debpython.patch new file mode 100644 index 000000000000000..dd00f8be8b59cc2 --- /dev/null +++ b/packages/python/debpython.patch @@ -0,0 +1,203 @@ +diff --git a/debpython/debpython/__init__.py b/debpython/debpython/__init__.py +index fa6b667..b3b63e1 100644 +--- a/debpython/debpython/__init__.py ++++ b/debpython/debpython/__init__.py +@@ -8,7 +8,7 @@ from subprocess import PIPE, Popen + from pickle import dumps + + log = logging.getLogger(__name__) +-PUBLIC_DIR_RE = re.compile(r'.*?/usr/lib/python(\d(?:.\d+)?)/(site|dist)-packages') ++PUBLIC_DIR_RE = re.compile(r'.*?@TERMUX_PREFIX@/lib/python(\d(?:.\d+)?)/(site|dist)-packages') + + + class memoize: +diff --git a/debpython/debpython/files.py b/debpython/debpython/files.py +index 39ef978..5899a7a 100644 +--- a/debpython/debpython/files.py ++++ b/debpython/debpython/files.py +@@ -48,7 +48,20 @@ def from_package(package_name, extensions=('.py',)): + extensions = tuple(extensions) # .endswith doesn't like list + env = environ.copy() + env["LC_ALL"] = "C.UTF-8" +- process = Popen(('/usr/bin/dpkg', '-L', package_name), stdout=PIPE, ++ env["LD_PRELOAD"] = "" ++ process = Popen(['@TERMUX_PREFIX@/bin/bash', '-c', ++ 'source @TERMUX_PREFIX_CLASSICAL@/bin/termux-setup-package-manager && echo ${TERMUX_APP_PACKAGE_MANAGER}'], ++ stdout=PIPE) ++ termux_app_package_manager = process.communicate()[0].decode()[0:-1] ++ if termux_app_package_manager == "apt": ++ package_manager = "@TERMUX_PREFIX_CLASSICAL@/bin/dpkg" ++ package_manager_list_argument = "-L" ++ elif termux_app_package_manager == "pacman": ++ package_manager = "@TERMUX_PREFIX_CLASSICAL@/bin/pacman" ++ package_manager_list_argument = "-Qql" ++ else: ++ raise Exception(f"cannot determine system package manager ({termux_app_package_manager})!") ++ process = Popen((package_manager, package_manager_list_argument, package_name), stdout=PIPE, + stderr=PIPE, env=env) + stdout, stderr = process.communicate() + if process.returncode != 0: +diff --git a/debpython/debpython/interpreter.py b/debpython/debpython/interpreter.py +index 45b14db..6334661 100644 +--- a/debpython/debpython/interpreter.py ++++ b/debpython/debpython/interpreter.py +@@ -171,16 +171,16 @@ class Interpreter: + #if not version: + # version = Version(DEFAULT) + if self.impl == 'pypy': +- path = '/usr/lib/pypy/dist-packages/' ++ path = '@TERMUX_PREFIX@/lib/pypy/dist-packages/' + elif version << Version('2.6'): +- path = "/usr/lib/python%s/site-packages/" % version ++ path = "@TERMUX_PREFIX@/lib/python%s/site-packages/" % version + elif version << Version('3.0'): +- path = "/usr/lib/python%s/dist-packages/" % version ++ path = "@TERMUX_PREFIX@/lib/python%s/dist-packages/" % version + else: +- path = '/usr/lib/python3/dist-packages/' ++ path = '@TERMUX_PREFIX@/lib/python@TERMUX_PYTHON_VERSION@/site-packages/' + + if gdb: +- path = "/usr/lib/debug%s" % path ++ path = "@TERMUX_PREFIX@/lib/debug%s" % path + if package: + path = "debian/%s%s" % (package, path) + +diff --git a/debpython/debpython/version.py b/debpython/debpython/version.py +index 2d7ed69..f4abf31 100644 +--- a/debpython/debpython/version.py ++++ b/debpython/debpython/version.py +@@ -42,13 +42,8 @@ log = logging.getLogger(__name__) + _supported = environ.get('DEBPYTHON3_SUPPORTED') + _default = environ.get('DEBPYTHON3_DEFAULT') + if not _supported or not _default: +- _config = ConfigParser() +- _config.read('/usr/share/python3/debian_defaults') +- if not _default: +- _default = _config.get('DEFAULT', 'default-version')[6:] +- if not _supported: +- _supported = _config.get('DEFAULT', 'supported-versions')\ +- .replace('python', '') ++ _supported = "@TERMUX_PYTHON_VERSION@" ++ _default = _supported + try: + DEFAULT = tuple(int(i) for i in _default.split('.')) + except Exception: +@@ -257,10 +252,10 @@ def get_requested_versions(vrange=None, available=None): + + if available: + versions = set(v for v in versions +- if exists("/usr/bin/python%d.%d" % v)) ++ if exists("@TERMUX_PREFIX@/bin/python%d.%d" % v)) + elif available is False: + versions = set(v for v in versions +- if not exists("/usr/bin/python%d.%d" % v)) ++ if not exists("@TERMUX_PREFIX@/bin/python%d.%d" % v)) + + return versions + +diff --git a/debpython/py3clean b/debpython/py3clean +index 8e7c3f3..62edeb5 100755 +--- a/debpython/py3clean ++++ b/debpython/py3clean +@@ -1,4 +1,4 @@ +-#! /usr/bin/python3 ++#! @TERMUX_PREFIX@/bin/python@TERMUX_PYTHON_VERSION@ + # vim: et ts=4 sw=4 + + # Copyright © 2010-2012 Piotr Ożarowski +@@ -27,7 +27,7 @@ import sys + from glob import glob + from os import environ, remove, rmdir + from os.path import dirname, basename, exists, join, splitext +-sys.path.insert(1, '/usr/share/python3/') ++sys.path.insert(1, '@TERMUX_PREFIX@/lib/python@TERMUX_PYTHON_VERSION@/') + from debpython import files as dpf + from debpython.interpreter import Interpreter + from debpython.version import SUPPORTED, getver, vrepr +@@ -156,13 +156,13 @@ def destroyer(magic_tag=None): # ;-) + + def main(): + usage = '%prog [-V VERSION] [-p PACKAGE] [DIR_OR_FILE]' +- parser = optparse.OptionParser(usage, version='%prog DEVELV') ++ parser = optparse.OptionParser(usage, version='%prog @TERMUX_PKG_FULLVERSION@') + parser.add_option('-v', '--verbose', action='store_true', dest='verbose', + help='turn verbose mode on') + parser.add_option('-q', '--quiet', action='store_false', dest='verbose', + default=False, help='be quiet') + parser.add_option('-p', '--package', +- help='specify Debian package name to clean') ++ help='specify Termux package name to clean') + parser.add_option('-V', dest='version', + help='specify Python version to clean') + +diff --git a/debpython/py3compile b/debpython/py3compile +index 14cbf4e..f2b0fed 100755 +--- a/debpython/py3compile ++++ b/debpython/py3compile +@@ -1,4 +1,4 @@ +-#! /usr/bin/python3 ++#! @TERMUX_PREFIX@/bin/python@TERMUX_PYTHON_VERSION@ + # vim: et ts=4 sw=4 + + # Copyright © 2010-2012 Piotr Ożarowski +@@ -30,7 +30,7 @@ import sys + from os import environ, listdir, mkdir + from os.path import dirname, exists, isdir, join + from subprocess import PIPE, Popen +-sys.path.insert(1, '/usr/share/python3/') ++sys.path.insert(1, '@TERMUX_PREFIX@/lib/python@TERMUX_PYTHON_VERSION@/') + from debpython.version import SUPPORTED, debsorted, vrepr, \ + get_requested_versions, parse_vrange, getver + from debpython import files as dpf, PUBLIC_DIR_RE, memoize +@@ -56,7 +56,7 @@ Examples: + + ### EXCLUDES ################################################### + @memoize +-def get_exclude_patterns_from_dir(name='/usr/share/python3/bcep/'): ++def get_exclude_patterns_from_dir(name='@TERMUX_PREFIX@/share/python3/bcep/'): + """Return patterns for files that shouldn't be bytecompiled.""" + if not isdir(name): + return [] +@@ -156,7 +156,7 @@ def filter_files(files, e_patterns, compile_versions): + def py_compile(version, optimize, workers): + if not isinstance(version, str): + version = vrepr(version) +- cmd = ["/usr/bin/python" + version] ++ cmd = ["@TERMUX_PREFIX@/bin/python" + version] + if optimize: + cmd.append("-O") + cmd += ["-m", "py_compile", "-"] +@@ -224,7 +224,7 @@ def compile(files, versions, force, optimize, e_patterns=None): + def main(): + usage = '%prog [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR]\n' +\ + ' %prog -p PACKAGE' +- parser = optparse.OptionParser(usage, version='%prog DEVELV', ++ parser = optparse.OptionParser(usage, version='%prog @TERMUX_PKG_FULLVERSION@', + option_class=Option) + parser.add_option('-v', '--verbose', action='store_true', dest='verbose', + help='turn verbose mode on') +@@ -236,7 +236,7 @@ def main(): + parser.add_option('-O', action='store_true', dest='optimize', + default=False, help="byte-compile to .pyo files") + parser.add_option('-p', '--package', +- help='specify Debian package name whose files should be bytecompiled') ++ help='specify Termux package name whose files should be bytecompiled') + parser.add_option('-V', type='version_range', dest='vrange', + help="""force private modules to be bytecompiled + with Python version from given range, regardless of the default Python version +@@ -262,12 +262,12 @@ You may use this option multiple times to build up a list of things to exclude.' + + if options.regexpr and not args: + parser.error('--exclude option works with private directories ' +- 'only, please use /usr/share/python3/bcep to specify ' ++ 'only, please use @TERMUX_PREFIX@/share/python3/bcep to specify ' + 'public modules to skip') + + if options.vrange and options.vrange[0] == options.vrange[1] and\ + options.vrange != (None, None) and\ +- exists("/usr/bin/python%d.%d" % options.vrange[0]): ++ exists("@TERMUX_PREFIX@/bin/python%d.%d" % options.vrange[0]): + # specific version requested, use it even if it's not in SUPPORTED + versions = {options.vrange[0]} + else: diff --git a/packages/python/python-tkinter.subpackage.sh b/packages/python/python-tkinter.subpackage.sh index 45364d37133bb8e..e6405571aadccfd 100644 --- a/packages/python/python-tkinter.subpackage.sh +++ b/packages/python/python-tkinter.subpackage.sh @@ -7,7 +7,6 @@ lib/python${_MAJOR_VERSION}/tkinter lib/python${_MAJOR_VERSION}/turtle.py lib/python${_MAJOR_VERSION}/turtledemo lib/python${_MAJOR_VERSION}/lib-dynload/_tkinter.*.so -lib/python${_MAJOR_VERSION}/__pycache__/turtle.*.pyc " TERMUX_SUBPKG_BREAKS="python (<< 3.11.1-3)" TERMUX_SUBPKG_REPLACES="python (<< 3.11.1-3)" diff --git a/scripts/build/setup/termux_setup_python_pip.sh b/scripts/build/setup/termux_setup_python_pip.sh index 7f47f2eea7178e3..ee8bd5feb48c1b7 100644 --- a/scripts/build/setup/termux_setup_python_pip.sh +++ b/scripts/build/setup/termux_setup_python_pip.sh @@ -68,5 +68,9 @@ termux_setup_python_pip() { export PATH="${TERMUX_PYTHON_CROSSENV_PREFIX}/build/bin:${PATH}" local _CROSS_PATH="${TERMUX_PYTHON_CROSSENV_PREFIX}/cross/bin" export PATH="${_CROSS_PATH}:$(echo -n $(tr ':' '\n' <<< "${PATH}" | grep -v "^${_CROSS_PATH}$") | tr ' ' ':')" + + local sysconfig_module=$(${TERMUX_PYTHON_CROSSENV_PREFIX}/build/bin/python -c "import sysconfig; print(sysconfig.__file__)") + cp -r "${sysconfig_module}" "${TERMUX_PYTHON_CROSSENV_BUILDHOME}" + sed -i "s|os.path.normpath(sys.*prefix)|\"${TERMUX_PREFIX}\"|g" "${TERMUX_PYTHON_CROSSENV_BUILDHOME}/${sysconfig_module##*/}" fi } diff --git a/scripts/build/termux_create_debian_subpackages.sh b/scripts/build/termux_create_debian_subpackages.sh index ef7ebee31091b55..1967f79646c0e18 100644 --- a/scripts/build/termux_create_debian_subpackages.sh +++ b/scripts/build/termux_create_debian_subpackages.sh @@ -34,6 +34,7 @@ termux_create_debian_subpackages() { local TERMUX_SUBPKG_CONFFILES="" local TERMUX_SUBPKG_DEPEND_ON_PARENT="" local TERMUX_SUBPKG_EXCLUDED_ARCHES="" + local TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="" local SUB_PKG_MASSAGE_DIR=$SUB_PKG_DIR/massage/$TERMUX_PREFIX_CLASSICAL local SUB_PKG_PACKAGE_DIR=$SUB_PKG_DIR/package mkdir -p "$SUB_PKG_MASSAGE_DIR" "$SUB_PKG_PACKAGE_DIR" @@ -138,6 +139,7 @@ termux_create_debian_subpackages() { # Allow packages to create arbitrary control files. termux_step_create_subpkg_debscripts + termux_step_create_python_debscripts # Create control.tar.xz tar --sort=name \ diff --git a/scripts/build/termux_create_pacman_subpackages.sh b/scripts/build/termux_create_pacman_subpackages.sh index ef2b8f11f4568e0..cb0366de8d131de 100644 --- a/scripts/build/termux_create_pacman_subpackages.sh +++ b/scripts/build/termux_create_pacman_subpackages.sh @@ -35,6 +35,7 @@ termux_create_pacman_subpackages() { local TERMUX_SUBPKG_DEPEND_ON_PARENT="" local TERMUX_SUBPKG_EXCLUDED_ARCHES="" local TERMUX_SUBPKG_GROUPS="" + local TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="" local SUB_PKG_MASSAGE_DIR=$SUB_PKG_DIR/massage/$TERMUX_PREFIX_CLASSICAL local SUB_PKG_PACKAGE_DIR=$SUB_PKG_DIR/package mkdir -p "$SUB_PKG_MASSAGE_DIR" "$SUB_PKG_PACKAGE_DIR" @@ -167,6 +168,7 @@ termux_create_pacman_subpackages() { # Write package installation hooks. termux_step_create_subpkg_debscripts + termux_step_create_python_debscripts termux_step_create_pacman_install_hook # Configuring the selection of a copress for a batch. diff --git a/scripts/build/termux_step_copy_into_massagedir.sh b/scripts/build/termux_step_copy_into_massagedir.sh index b77eacd3d366a70..888ac35203d6b3d 100644 --- a/scripts/build/termux_step_copy_into_massagedir.sh +++ b/scripts/build/termux_step_copy_into_massagedir.sh @@ -2,6 +2,6 @@ termux_step_copy_into_massagedir() { local DEST="$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX_CLASSICAL" mkdir -p "$DEST" # Copy files changed during the build into massagedir in order to massage them - tar -C "$TERMUX_PREFIX_CLASSICAL" -N "$TERMUX_BUILD_TS_FILE" --exclude='tmp' -cf - . | \ + tar -C "$TERMUX_PREFIX_CLASSICAL" -N "$TERMUX_BUILD_TS_FILE" --exclude='tmp' --exclude='__pycache__' -cf - . | \ tar -C "$DEST" -xf - } diff --git a/scripts/build/termux_step_create_debian_package.sh b/scripts/build/termux_step_create_debian_package.sh index eb3bceed59a90a4..a2ce8f058f8129a 100644 --- a/scripts/build/termux_step_create_debian_package.sh +++ b/scripts/build/termux_step_create_debian_package.sh @@ -54,6 +54,7 @@ termux_step_create_debian_package() { # Process `update-alternatives` entries from `.alternatives` files # These need to be merged into the `.postinst` and `.prerm` files, so after those are created. termux_step_update_alternatives + termux_step_create_python_debscripts # Create control.tar.xz tar --sort=name \ diff --git a/scripts/build/termux_step_create_pacman_package.sh b/scripts/build/termux_step_create_pacman_package.sh index ed987e3ea539bc7..25a0ae4e7b594b5 100644 --- a/scripts/build/termux_step_create_pacman_package.sh +++ b/scripts/build/termux_step_create_pacman_package.sh @@ -125,6 +125,7 @@ termux_step_create_pacman_package() { # Process `update-alternatives` entries from `.alternatives` files # These need to be merged into the `.postinst` and `.prerm` files, so after those are created. termux_step_update_alternatives + termux_step_create_python_debscripts termux_step_create_pacman_install_hook # ensure all elements of the package have the same mtime diff --git a/scripts/build/termux_step_create_python_debscripts.sh b/scripts/build/termux_step_create_python_debscripts.sh new file mode 100644 index 000000000000000..ca4688202b7a286 --- /dev/null +++ b/scripts/build/termux_step_create_python_debscripts.sh @@ -0,0 +1,116 @@ +termux_step_create_python_debscripts() { + if [[ -n "${SUB_PKG_NAME-}" ]]; then + local _package_name="$SUB_PKG_NAME" + local _package_massagedir="$SUB_PKG_DIR/massage/$TERMUX_PREFIX" + local _package_python_deps="${TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS//, / }" + else + local _package_name="$TERMUX_PKG_NAME" + local _package_massagedir="$TERMUX_PKG_MASSAGEDIR$TERMUX_PREFIX" + local _package_python_deps="${TERMUX_PKG_PYTHON_RUNTIME_DEPS//, / }" + fi + + # if the package does not contain any .py files in + # $TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION, + # then debpython (py3compile and py3clean) are not + # necessary or not currently supported for this package + local contains_py_files_in_lib_python=false + + if [[ -d "$_package_massagedir/lib/python$TERMUX_PYTHON_VERSION/" ]]; then + local py_file_in_lib_python="$(find \ + "$_package_massagedir/lib/python$TERMUX_PYTHON_VERSION/" \ + -name "*.py" -print -quit)" + if [[ -n "$py_file_in_lib_python" ]]; then + contains_py_files_in_lib_python=true + fi + fi + + # if there are no .py files in $TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION/, + # and the package either is a subpackage or has an empty $_package_python_deps, + # then this function does not need to do anything + if [[ "$contains_py_files_in_lib_python" == "false" ]]; then + if [[ -n "${SUB_PKG_NAME-}" || -z "${_package_python_deps}" ]]; then + return + fi + fi + + # if a postinst script does not already exist, create a new one + # but if the postinst script already exists and has 'exit 0' + # as its last line, remove that line so that it does not + # prevent execution of the additional commands + if [[ ! -f postinst ]]; then + echo "#!${TERMUX_PREFIX_CLASSICAL}/bin/sh" > postinst + chmod 0755 postinst + elif tail -n1 postinst | grep -q 'exit 0'; then + sed -i '$d' postinst + fi + + # if the package format is .deb, only run the script + # if the package is being configured (not failed) + if [[ "$TERMUX_PACKAGE_FORMAT" == "debian" ]]; then + cat <<- POSTINST_EOF >> postinst + if [ "\$1" != "configure" ]; then + exit 0 + fi + POSTINST_EOF + fi + + # if the package has runtime dependencies requiring pip, + # make this script install them + if [[ -n "${_package_python_deps}" ]]; then + local upgrade_flag="--upgrade" + if [[ " $(tr ' ' '\n' <<< "${_package_python_deps}" | sed "s/'//g; s// /g; s/=/ /g" | awk '{printf $1 " "}')" =~ " ${_package_name//python-/} " ]]; then + upgrade_flag="" + fi + cat <<- POSTINST_EOF >> postinst + echo "Installing dependencies for ${_package_name} through pip..." + LD_PRELOAD='' LDFLAGS="-lpython$TERMUX_PYTHON_VERSION" MATHLIB="m" "${TERMUX_PREFIX}/bin/pip3" install ${upgrade_flag} ${_package_python_deps} + POSTINST_EOF + fi + + # if the package does not contain any .py files in + # $TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION, + # then this function does not need to do anything else + if [[ "$contains_py_files_in_lib_python" == "false" ]]; then + return + fi + + # post-inst script to generate *.pyc files + cat <<- POSTINST_EOF >> postinst + if [ -f "${TERMUX_PREFIX}/bin/py3compile" ]; then + LD_PRELOAD='' "${TERMUX_PREFIX}/bin/py3compile" -p "$_package_name" "${TERMUX_PREFIX}/lib/python${TERMUX_PYTHON_VERSION}/" + fi + POSTINST_EOF + + # if a prerm script does not already exist, create a new one + # but if the prerm script already exists and has 'exit 0' + # as its last line, remove that line so that it does not + # prevent execution of the additional commands + if [[ ! -f prerm ]]; then + echo "#!${TERMUX_PREFIX_CLASSICAL}/bin/sh" > prerm + chmod 0755 prerm + elif tail -n1 prerm | grep -q 'exit 0'; then + sed -i '$d' prerm + fi + + # if the package format is .deb, only run the script + # if the package is being removed (not failed) + if [[ "$TERMUX_PACKAGE_FORMAT" == "debian" ]]; then + cat <<- PRERM_EOF >> prerm + if [ "\$1" != "remove" ]; then + exit 0 + fi + PRERM_EOF + fi + + # pre-rm script to cleanup runtime-generated files. + cat <<- PRERM_EOF >> prerm + if [ -f "${TERMUX_PREFIX}/bin/py3clean" ]; then + LD_PRELOAD='' "${TERMUX_PREFIX}/bin/py3clean" -p "$_package_name" + fi + PRERM_EOF + + # running py3compile in a package for pacman during a package update + if [[ "$TERMUX_PACKAGE_FORMAT" == "pacman" ]] && ! grep -qs 'post_install' postupg; then + echo "post_install" >> postupg + fi +} diff --git a/scripts/build/termux_step_get_dependencies_python.sh b/scripts/build/termux_step_get_dependencies_python.sh index 5c079da66cc295b..5da9a7bbbe04ff1 100644 --- a/scripts/build/termux_step_get_dependencies_python.sh +++ b/scripts/build/termux_step_get_dependencies_python.sh @@ -27,9 +27,9 @@ termux_step_get_dependencies_python() { done # adding and setting values ​​to work properly with python modules - export PYTHONPATH=$TERMUX_PYTHON_HOME/site-packages + export PYTHONPATH="${TERMUX_PYTHON_CROSSENV_BUILDHOME}:${TERMUX_PYTHON_HOME}/site-packages" if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then - export TERMUX_PYTHON_MAINPATH="${PYTHONPATH}:${TERMUX_PYTHON_CROSSENV_PREFIX}/build/lib/python${TERMUX_PYTHON_VERSION}/site-packages" + export TERMUX_PYTHON_MAINPATH="${PYTHONPATH}:${TERMUX_PYTHON_CROSSENV_BUILDHOME}/site-packages" fi export PYTHON_SITE_PKG=$PYTHONPATH fi diff --git a/scripts/build/termux_step_setup_variables.sh b/scripts/build/termux_step_setup_variables.sh index c1b6872f9633516..324874d577c9850 100644 --- a/scripts/build/termux_step_setup_variables.sh +++ b/scripts/build/termux_step_setup_variables.sh @@ -173,7 +173,9 @@ termux_step_setup_variables() { TERMUX_PKG_PYTHON_TARGET_DEPS="" # python modules to be installed via pip3 TERMUX_PKG_PYTHON_BUILD_DEPS="" # python modules to be installed via build-pip TERMUX_PKG_PYTHON_COMMON_DEPS="" # python modules to be installed via pip3 or build-pip + TERMUX_PKG_PYTHON_RUNTIME_DEPS="" # python modules to be installed via pip3 in debscriptps TERMUX_PYTHON_CROSSENV_PREFIX="$TERMUX_TOPDIR/python${TERMUX_PYTHON_VERSION}-crossenv-prefix-$TERMUX_PACKAGE_LIBRARY-$TERMUX_ARCH" # python modules dependency location (only used in non-devices) + TERMUX_PYTHON_CROSSENV_BUILDHOME="$TERMUX_PYTHON_CROSSENV_PREFIX/build/lib/python${TERMUX_PYTHON_VERSION}" TERMUX_PYTHON_HOME=$TERMUX__PREFIX__LIB_DIR/python${TERMUX_PYTHON_VERSION} # location of python libraries TERMUX_PKG_MESON_NATIVE=false TERMUX_PKG_CMAKE_CROSSCOMPILING=true diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index 47ec3a9fb5f74c9..3d3930cb566b755 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -22,6 +22,24 @@ termux_step_start_build() { # Enable python setting TERMUX_PKG_SETUP_PYTHON=true fi + if [ -z "$TERMUX_PKG_PYTHON_RUNTIME_DEPS" ]; then + TERMUX_PKG_PYTHON_RUNTIME_DEPS="$TERMUX_PKG_PYTHON_TARGET_DEPS" + fi + if [ "$TERMUX_PKG_PYTHON_RUNTIME_DEPS" = "false" ]; then + TERMUX_PKG_PYTHON_RUNTIME_DEPS="" + fi + # Add python-pip{-glibc} dependency if plan to install python modules + if [ -n "$TERMUX_PKG_PYTHON_RUNTIME_DEPS" ]; then + local TERMUX_PKG_NAME_PIP="python-pip" + if [ "$TERMUX_PACKAGE_LIBRARY" = "glibc" ]; then + TERMUX_PKG_NAME_PIP+="-glibc" + fi + if [ -n "$TERMUX_PKG_DEPENDS" ]; then + TERMUX_PKG_DEPENDS+=", $TERMUX_PKG_NAME_PIP" + else + TERMUX_PKG_DEPENDS="$TERMUX_PKG_NAME_PIP" + fi + fi TERMUX_PKG_FULLVERSION=$TERMUX_PKG_VERSION if [ "$TERMUX_PKG_REVISION" != "0" ] || [ "$TERMUX_PKG_FULLVERSION" != "${TERMUX_PKG_FULLVERSION/-/}" ]; then diff --git a/scripts/buildorder.py b/scripts/buildorder.py index b69f4c32d111174..01f2e072cf35363 100755 --- a/scripts/buildorder.py +++ b/scripts/buildorder.py @@ -39,7 +39,7 @@ def parse_build_file_dependencies_with_vars(path, vars): with open(path, encoding="utf-8") as build_script: for line in build_script: if line.startswith(vars): - dependencies_string = line.split('DEPENDS=')[1] + dependencies_string = line.split('DEPS=' if 'DEPS=' in line else 'DEPENDS=')[1] for char in "\"'\n": dependencies_string = dependencies_string.replace(char, '') @@ -115,6 +115,14 @@ def __init__(self, dir_path, fast_build_mode): raise Exception("build.sh not found for package '" + self.name + "'") self.deps = parse_build_file_dependencies(build_sh_path) + py_deps = parse_build_file_dependencies_with_vars(build_sh_path, 'TERMUX_PKG_PYTHON_RUNTIME_DEPS') + if not py_deps: + py_deps = parse_build_file_dependencies_with_vars(build_sh_path, 'TERMUX_PKG_PYTHON_TARGET_DEPS') + elif len(py_deps) == list(py_deps).count("false"): + py_deps = set() + if py_deps: + self.deps.add(f"python-pip{'-glibc' if termux_pkg_library == 'glibc' else ''}") + self.antideps = parse_build_file_antidependencies(build_sh_path) self.excluded_arches = parse_build_file_excluded_arches(build_sh_path) self.only_installing = parse_build_file_variable_bool(build_sh_path, 'TERMUX_PKG_ONLY_INSTALLING') @@ -192,6 +200,8 @@ def __init__(self, subpackage_file_path, parent, virtual=False): self.excluded_arches = set() if not virtual: self.deps |= parse_build_file_dependencies(subpackage_file_path) + if parse_build_file_dependencies_with_vars(subpackage_file_path, 'TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS'): + self.deps.add(f"python-pip{'-glibc' if termux_pkg_library == 'glibc' else ''}") self.excluded_arches |= parse_build_file_excluded_arches(subpackage_file_path) self.dir = parent.dir diff --git a/scripts/setup-termux.sh b/scripts/setup-termux.sh index 30d6f764bd15770..05baee708c16891 100755 --- a/scripts/setup-termux.sh +++ b/scripts/setup-termux.sh @@ -8,6 +8,7 @@ PACKAGES+=" gnupg" # Used in termux_get_repo_files() and build-package.sh. PACKAGES+=" lzip" # Used by tar to extract *.tar.lz source archives. PACKAGES+=" patch" # Used for applying patches on source code. PACKAGES+=" python" # Used buildorder.py core script. +PACKAGES+=" python-pip" # Necessary to install 'itstool' for on-device-building (since Ubuntu gets it from 'apt') PACKAGES+=" unzip" # Used to extract *.zip source archives. PACKAGES+=" jq" # Used for parsing repo.json. PACKAGES+=" binutils-is-llvm" # Used for checking symbols. @@ -34,6 +35,12 @@ PACKAGES+=" m4" PACKAGES+=" make" # Used for all Makefile-based projects. PACKAGES+=" ndk-multilib" # Needed to build rust PACKAGES+=" ninja" # Used by default to build all CMake projects. +# Needed to hypothetically build nala, is present in Ubuntu cross-builder image, and should be enabled, +# but a mostly separate issue (involving Perl) prevents enabling this +# that is in a family of other, interrelated Perl-related problems with on-device building. +# robertkirkman plans to try to make a PR to solve the issue if possible, but has only +# a rough implementation of a workaround currently. Contact robertkirkman for more information +#PACKAGES+=" pandoc" PACKAGES+=" perl" PACKAGES+=" pkg-config" PACKAGES+=" protobuf" @@ -47,6 +54,16 @@ PACKAGES+=" valac" PACKAGES+=" xmlto" # Needed by git's manpage generation PACKAGES+=" zip" +PYTHON_PACKAGES="" + +PYTHON_PACKAGES+=" itstool" # necessary to build orca and some other packages +# More 'system-wide' python packages should be added here if working towards the goal +# of setup-termux.sh for on-device building having closer behavior +# to setup-ubuntu.sh for cross-compilation. If adding packages here, please add a comment +# for each one naming at least one of its reverse build dependencies, for which least one +# error during on-device building is solved by installing the dependency through pip. +#PYTHON_PACKAGES+=" " + # Definition of a package manager export TERMUX_SCRIPTDIR=$(dirname "$(realpath "$0")")/../ . $(dirname "$(realpath "$0")")/properties.sh @@ -62,3 +79,9 @@ else echo "Error: no package manager defined" exit 1 fi + +# Should not be installed inside venv because on Ubuntu cross-builder image, these +# particular python packages are installed system-wide, +# so should be installed Termux-wide for on-device building to be reasonably accurate +# compared with the behavior of the Ubuntu cross-builder image. +pip install $PYTHON_PACKAGES From 0cf8ab5aa64ec988b53a89ab4b81ef56fafff324 Mon Sep 17 00:00:00 2001 From: Maxython Date: Tue, 1 Jul 2025 01:36:56 +0300 Subject: [PATCH 2/3] Recompiling packages with debpython - packages/borgbackup - packages/electrum - packages/hash-slinger - packages/lv2 - packages/manim - packages/nala - packages/python-cryptography - packages/python-tldp - packages/python-xlib - packages/rdiff-backup - packages/rdircd - packages/sabnzbd - packages/srt2vobsub - packages/termux-gui-package - packages/termux-gui-pm - packages/ytui-music - x11-packages/orca - x11-packages/pyqt5 - packages/matplotlib - packages/python-onnxruntime - packages/python-torch - packages/python-torchvision - packages/python-yt-dlp - x11-packages/xfce4-panel-profiles - disabled-packages/python-pandas - packages/calcurse - packages/units - root-packages/frida - x11-packages/inkscape Co-authored-by: @robertkirkman --- disabled-packages/python-pandas/build.sh | 10 +--------- packages/borgbackup/build.sh | 11 ++--------- packages/calcurse/build.sh | 2 +- packages/calcurse/calcurse-caldav.subpackage.sh | 6 +----- packages/electrum/build.sh | 12 ++---------- packages/hash-slinger/build.sh | 11 ++--------- packages/lv2/build.sh | 12 ++---------- packages/manim/build.sh | 10 +--------- packages/matplotlib/build.sh | 12 +++--------- packages/nala/build.sh | 6 +++--- packages/python-cryptography/build.sh | 11 ++--------- packages/python-cryptography/pyproject.toml.patch | 10 ++++++++++ packages/python-onnxruntime/build.sh | 14 ++++---------- packages/python-tldp/build.sh | 12 ++---------- packages/python-torch/build.sh | 14 ++++++-------- packages/python-torchvision/build.sh | 11 +++-------- packages/python-xlib/build.sh | 12 ++---------- packages/python-yt-dlp/build.sh | 9 +-------- packages/rdiff-backup/build.sh | 11 ++--------- packages/rdircd/build.sh | 12 ++---------- packages/sabnzbd/build.sh | 9 +-------- packages/srt2vobsub/build.sh | 12 ++---------- packages/termux-gui-package/build.sh | 12 ++---------- packages/termux-gui-pm/build.sh | 12 ++---------- packages/units/build.sh | 1 + packages/units/units-cur.subpackage.sh | 9 +-------- packages/ytui-music/build.sh | 14 ++++---------- root-packages/frida/build.sh | 1 + root-packages/frida/frida-python.subpackage.sh | 7 +------ x11-packages/inkscape/build.sh | 1 + .../inkscape/inkscape-extensions.subpackage.sh | 9 +-------- x11-packages/orca/build.sh | 11 ++--------- x11-packages/pyqt5/build.sh | 12 ++---------- x11-packages/xfce4-panel-profiles/build.sh | 10 +--------- 34 files changed, 74 insertions(+), 254 deletions(-) create mode 100644 packages/python-cryptography/pyproject.toml.patch diff --git a/disabled-packages/python-pandas/build.sh b/disabled-packages/python-pandas/build.sh index 27547da146adc8e..a28c93b0ef23747 100644 --- a/disabled-packages/python-pandas/build.sh +++ b/disabled-packages/python-pandas/build.sh @@ -6,7 +6,7 @@ TERMUX_PKG_VERSION=1.5.3 TERMUX_PKG_SRCURL=https://github.com/pandas-dev/pandas/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=d8abf9c2bf33cac75b28f32c174c29778414eb249e5e2ccb69b1079b97a8fc66 TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="libc++, python, python-numpy, python-pip" +TERMUX_PKG_DEPENDS="libc++, python, python-numpy" TERMUX_PKG_PYTHON_COMMON_DEPS="Cython, numpy, wheel" TERMUX_PKG_PYTHON_TARGET_DEPS="python-dateutil, pytz" TERMUX_PKG_BUILD_IN_SRC=true @@ -18,11 +18,3 @@ termux_step_pre_configure() { termux_step_make_install() { pip install --no-deps --no-build-isolation . --prefix $TERMUX_PREFIX } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/borgbackup/build.sh b/packages/borgbackup/build.sh index f2ab2b49182be33..eb78d5788e8ea8f 100644 --- a/packages/borgbackup/build.sh +++ b/packages/borgbackup/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Deduplicating and compressing backup program" TERMUX_PKG_LICENSE="BSD 3-Clause" TERMUX_PKG_MAINTAINER="Joshua Kahn @TomJo2000" TERMUX_PKG_VERSION="1.4.1" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/borgbackup/borg/releases/download/${TERMUX_PKG_VERSION}/borgbackup-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=b8fbf8f1c19d900b6b32a5a1dc131c5d8665a7c7eea409e9095209100b903839 TERMUX_PKG_DEPENDS="libacl, liblz4, openssl, python, xxhash, zstd" @@ -17,13 +18,5 @@ termux_step_make() { termux_step_make_install() { local _pyver="${TERMUX_PYTHON_VERSION//./}" local _wheel="borgbackup-${TERMUX_PKG_VERSION}-cp${_pyver}-cp${_pyver}-linux_${TERMUX_ARCH}.whl" - pip install --no-deps --prefix="$TERMUX_PREFIX" "$TERMUX_PKG_SRCDIR/dist/${_wheel}" -} - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install $TERMUX_PKG_PYTHON_TARGET_DEPS - EOF + pip install --force-reinstall --no-deps --prefix="$TERMUX_PREFIX" "$TERMUX_PKG_SRCDIR/dist/${_wheel}" } diff --git a/packages/calcurse/build.sh b/packages/calcurse/build.sh index 01f72e295b19998..6902abd81d84ef2 100644 --- a/packages/calcurse/build.sh +++ b/packages/calcurse/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="calcurse is a calendar and scheduling application for th TERMUX_PKG_LICENSE="BSD 2-Clause" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=4.8.1 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=https://calcurse.org/files/calcurse-$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=d86bb37014fd69b8d83ccb904ac979c6b8ddf59ee3dbc80f5a274525e4d5830a TERMUX_PKG_DEPENDS="libandroid-support, ncurses" diff --git a/packages/calcurse/calcurse-caldav.subpackage.sh b/packages/calcurse/calcurse-caldav.subpackage.sh index 6872330e30abf04..bea8a1c273f54f3 100644 --- a/packages/calcurse/calcurse-caldav.subpackage.sh +++ b/packages/calcurse/calcurse-caldav.subpackage.sh @@ -3,8 +3,4 @@ TERMUX_SUBPKG_DESCRIPTION="Sync calcurse with remote caldav calendar" TERMUX_SUBPKG_DEPENDS="python, python-pip" TERMUX_SUBPKG_REPLACES="calcurse (<< 4.7.1-1)" TERMUX_SUBPKG_BREAKS="calcurse (<< 4.7.1-1)" - -termux_step_create_subpkg_debscripts() { - echo "#!$TERMUX_PREFIX/bin/sh" > postinst - echo "pip3 install httplib2" >> postinst -} +TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="httplib2" diff --git a/packages/electrum/build.sh b/packages/electrum/build.sh index 4a00b7d6027b104..f846cbbd521b162 100644 --- a/packages/electrum/build.sh +++ b/packages/electrum/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Electrum is a lightweight Bitcoin wallet" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="4.5.8" -TERMUX_PKG_REVISION=2 +TERMUX_PKG_REVISION=3 TERMUX_PKG_SRCURL=https://download.electrum.org/$TERMUX_PKG_VERSION/Electrum-$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=dd8595a138132dee87cee76ce760a1d622fc2fd65d3b6ac7df7e53b7fb6ea7e8 # The python dependency list should be compared to @@ -11,7 +11,7 @@ TERMUX_PKG_SHA256=dd8595a138132dee87cee76ce760a1d622fc2fd65d3b6ac7df7e53b7fb6ea7 # update (or at least every major update). Disable auto updates for # now. TERMUX_PKG_AUTO_UPDATE=false -TERMUX_PKG_DEPENDS="python, libsecp256k1, python-pip, python-cryptography" +TERMUX_PKG_DEPENDS="python, libsecp256k1, python-cryptography" TERMUX_PKG_PYTHON_TARGET_DEPS="'qrcode', 'protobuf<4,>=3.20', 'qdarkstyle>=2.7', 'aiorpcx<0.24,>=0.22.0', 'aiohttp<4.0.0,>=3.3.0', 'aiohttp_socks>=0.8.4', 'certifi', 'attrs>=20.1.0', 'jsonpatch', 'dnspython>=2.0'" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_PLATFORM_INDEPENDENT=true @@ -19,11 +19,3 @@ TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_CONFLICTS="asciinema (<< 1.4.0-1)" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" TERMUX_PKG_SERVICE_SCRIPT=("electrum" 'exec electrum daemon 2>&1') - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/hash-slinger/build.sh b/packages/hash-slinger/build.sh index a8d816a6ba93fce..a44172852734086 100644 --- a/packages/hash-slinger/build.sh +++ b/packages/hash-slinger/build.sh @@ -3,10 +3,11 @@ TERMUX_PKG_DESCRIPTION="Various tools to generate special DNS records" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="3.4" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/letoams/hash-slinger/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=46274aa2124c766c2c15c73576f895db7556bf03c7d3e9e4bb917858fae34ffc TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="ca-certificates, gnupg, openssh, python, pyunbound, resolv-conf, swig, python-pip" +TERMUX_PKG_DEPENDS="ca-certificates, gnupg, openssh, python, pyunbound, resolv-conf, swig" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_PYTHON_TARGET_DEPS="dnspython, ipaddr, m2crypto, python-gnupg" @@ -22,11 +23,3 @@ termux_step_make_install() { install -Dm600 -t $TERMUX_PREFIX/share/man/man1 ${f}.1 done } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/lv2/build.sh b/packages/lv2/build.sh index d21e425adb06af5..f4f4116b2a849cf 100644 --- a/packages/lv2/build.sh +++ b/packages/lv2/build.sh @@ -3,17 +3,9 @@ TERMUX_PKG_DESCRIPTION="A plugin standard for audio systems" TERMUX_PKG_LICENSE="ISC" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=1.18.10 -TERMUX_PKG_REVISION=5 +TERMUX_PKG_REVISION=6 TERMUX_PKG_SRCURL=https://lv2plug.in/spec/lv2-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=78c51bcf21b54e58bb6329accbb4dae03b2ed79b520f9a01e734bd9de530953f -TERMUX_PKG_DEPENDS="libxml2, libxslt, python, sord, python-pip, python-lxml" +TERMUX_PKG_DEPENDS="libxml2, libxslt, python, sord, python-lxml" TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-Dplugins=disabled" TERMUX_PKG_PYTHON_TARGET_DEPS="pygments, rdflib" - -termux_step_create_debscripts() { - cat <<-EOF >./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/manim/build.sh b/packages/manim/build.sh index 757bad84dd368d7..da296a3c5a62c55 100644 --- a/packages/manim/build.sh +++ b/packages/manim/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="A community-maintained Python framework for creating mat TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="Nguyen Khanh @nguynkhn" TERMUX_PKG_VERSION="0.19.0" -TERMUX_PKG_REVISION=2 +TERMUX_PKG_REVISION=3 TERMUX_PKG_SRCURL=https://github.com/ManimCommunity/manim/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=9047d87bb5ac9d008d22f5d444b984e5b630585a073d69506ef0164c804df2c3 TERMUX_PKG_DEPENDS="ffmpeg, libcairo, pango, xorgproto, python-numpy, python-pillow, pycairo, python-scipy, python-skia-pathops" @@ -13,11 +13,3 @@ TERMUX_PKG_PYTHON_COMMON_DEPS="poetry" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_EXCLUDED_ARCHES="arm, i686" - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/matplotlib/build.sh b/packages/matplotlib/build.sh index f3cd19d76233e61..30001a293d3e2e9 100644 --- a/packages/matplotlib/build.sh +++ b/packages/matplotlib/build.sh @@ -15,12 +15,14 @@ LICENSE/LICENSE_STIX LICENSE/LICENSE_YORICK" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="3.10.3" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/matplotlib/matplotlib/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=d581d3cec14478a0347631f93d534c2acf11bf554670eedd0a200f56ec979d12 TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="freetype, libc++, patchelf, ninja, python, python-contourpy, python-numpy, python-pillow, python-pip" +TERMUX_PKG_DEPENDS="freetype, libc++, patchelf, ninja, python, python-contourpy, python-numpy, python-pillow" _NUMPY_VERSION=$(. $TERMUX_SCRIPTDIR/packages/python-numpy/build.sh; echo $TERMUX_PKG_VERSION) TERMUX_PKG_PYTHON_COMMON_DEPS="build, 'meson-python>=0.13.1', wheel, 'numpy==$_NUMPY_VERSION', 'pybind11>=2.6.0', 'setuptools>=64', 'setuptools_scm>=7'" +TERMUX_PKG_PYTHON_RUNTIME_DEPS="matplotlib" TERMUX_MESON_WHEEL_CROSSFILE="$TERMUX_PKG_TMPDIR/wheel-cross-file.txt" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" @@ -58,11 +60,3 @@ termux_step_make_install() { local _whl="matplotlib-$TERMUX_PKG_VERSION-cp$_pyv-cp$_pyv-linux_$TERMUX_ARCH.whl" pip install --no-deps --prefix=$TERMUX_PREFIX --force-reinstall $TERMUX_PKG_SRCDIR/dist/$_whl } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip. This may take a while..." - MATHLIB="m" pip3 install matplotlib - EOF -} diff --git a/packages/nala/build.sh b/packages/nala/build.sh index e99a55d344e173b..9d74385c3849319 100644 --- a/packages/nala/build.sh +++ b/packages/nala/build.sh @@ -3,15 +3,17 @@ TERMUX_PKG_DESCRIPTION="Commandline frontend for the apt package manager" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="0.16.0" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://gitlab.com/volian/nala/-/archive/v${TERMUX_PKG_VERSION}/nala-v${TERMUX_PKG_VERSION}.tar.bz2 TERMUX_PKG_SHA256=49e384aa3b94597d09c61b7accc41d1cf10cb6beea85d4620c80c28d7cdc4d5f -TERMUX_PKG_DEPENDS="python-apt, python-pip" +TERMUX_PKG_DEPENDS="python-apt" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag" TERMUX_PKG_PYTHON_COMMON_DEPS="poetry" TERMUX_PKG_PYTHON_TARGET_DEPS="anyio, httpx, jsbeautifier, pexpect, python-debian, rich, tomli, typer, typing-extensions" +TERMUX_PKG_PYTHON_RUNTIME_DEPS="nala, python-debian" termux_step_pre_configure() { rm -rf nala/__init__.py.orig @@ -42,7 +44,5 @@ termux_step_create_debscripts() { mkdir -p $TERMUX_PREFIX/var/lib/nala mkdir -p $TERMUX_PREFIX/var/log/nala mkdir -p $TERMUX_PREFIX/var/lock - echo "Installing dependencies through pip..." - pip3 install nala python-debian EOF } diff --git a/packages/python-cryptography/build.sh b/packages/python-cryptography/build.sh index 40c3d4bcb6a8a31..4931697541de4a2 100644 --- a/packages/python-cryptography/build.sh +++ b/packages/python-cryptography/build.sh @@ -4,10 +4,11 @@ TERMUX_PKG_LICENSE="Apache-2.0, BSD 3-Clause" TERMUX_PKG_LICENSE_FILE="LICENSE, LICENSE.APACHE, LICENSE.BSD" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="45.0.5" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/pyca/cryptography/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=b17510b03a3c1d1be1aa1b26995a0aca0f1c83f1a749b85ea637f2ccc4850960 TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="openssl, python, python-pip" +TERMUX_PKG_DEPENDS="openssl, python" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, maturin" @@ -19,11 +20,3 @@ termux_step_configure() { export CARGO_BUILD_TARGET=${CARGO_TARGET_NAME} export PYO3_CROSS_LIB_DIR=$TERMUX_PREFIX/lib } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install $TERMUX_PKG_PYTHON_TARGET_DEPS - EOF -} diff --git a/packages/python-cryptography/pyproject.toml.patch b/packages/python-cryptography/pyproject.toml.patch new file mode 100644 index 000000000000000..1701c2ee998698e --- /dev/null +++ b/packages/python-cryptography/pyproject.toml.patch @@ -0,0 +1,10 @@ +--- cryptography-45.0.4/pyproject.toml 2025-06-10 02:53:24.000000000 +0300 ++++ cryptography-45.0.4/pyproject.toml.patch 2025-07-02 00:01:20.936683141 +0300 +@@ -11,7 +11,6 @@ + # well as our build.rs for the rust/cffi bridge. + "setuptools!=74.0.0,!=74.1.0,!=74.1.1,!=74.1.2", + ] +-build-backend = "maturin" + + [project] + name = "cryptography" diff --git a/packages/python-onnxruntime/build.sh b/packages/python-onnxruntime/build.sh index 5a325859fb5ae30..3affdf34d26a04d 100644 --- a/packages/python-onnxruntime/build.sh +++ b/packages/python-onnxruntime/build.sh @@ -3,11 +3,13 @@ TERMUX_PKG_DESCRIPTION="Cross-platform, high performance ML inferencing and trai TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="1.22.1" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=git+https://github.com/microsoft/onnxruntime TERMUX_PKG_DEPENDS="abseil-cpp, libc++, protobuf, libre2, python" TERMUX_PKG_BUILD_DEPENDS="python-numpy" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, build, packaging" +TERMUX_PKG_PYTHON_RUNTIME_DEPS="onnxruntime" TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_UPDATE_TAG_TYPE="latest-release-tag" @@ -29,7 +31,7 @@ termux_step_pre_configure() { TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DPYTHON_EXECUTABLE=$(command -v python3)" TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DONNX_CUSTOM_PROTOC_EXECUTABLE=$(command -v protoc)" - TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DPython_NumPy_INCLUDE_DIR=$TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION/site-packages/numpy/_core/include" + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DPython_NumPy_INCLUDE_DIR=$TERMUX_PYTHON_HOME/site-packages/numpy/_core/include" local TERMUX_PKG_SRCDIR_SAVE="$TERMUX_PKG_SRCDIR" TERMUX_PKG_SRCDIR+="/cmake" @@ -46,13 +48,5 @@ termux_step_make() { termux_step_make_install() { local _pyver="${TERMUX_PYTHON_VERSION//./}" local _wheel="onnxruntime-${TERMUX_PKG_VERSION}-cp${_pyver}-cp${_pyver}-linux_${TERMUX_ARCH}.whl" - pip install --no-deps --prefix="$TERMUX_PREFIX" "$TERMUX_PKG_SRCDIR/dist/${_wheel}" -} - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install onnxruntime - EOF + pip install --force-reinstall --no-deps --prefix="$TERMUX_PREFIX" "$TERMUX_PKG_SRCDIR/dist/${_wheel}" } diff --git a/packages/python-tldp/build.sh b/packages/python-tldp/build.sh index 1a99e5cfecde6b1..facb42e44740f38 100644 --- a/packages/python-tldp/build.sh +++ b/packages/python-tldp/build.sh @@ -3,21 +3,13 @@ TERMUX_PKG_DESCRIPTION="Tools for publishing from TLDP sources" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=0.7.5 -TERMUX_PKG_REVISION=5 +TERMUX_PKG_REVISION=6 TERMUX_PKG_SRCURL=https://github.com/tLDP/python-tldp/archive/refs/tags/tldp-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=bae313095b877b4272ddccaabd70efcbc526e2c1036f63fb665ec7ce10c94cde TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_UPDATE_METHOD=repology -TERMUX_PKG_DEPENDS="python, python-pip" +TERMUX_PKG_DEPENDS="python" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" TERMUX_PKG_PYTHON_TARGET_DEPS="networkx, nose" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/python-torch/build.sh b/packages/python-torch/build.sh index 0480f128925056e..da414d093c77023 100644 --- a/packages/python-torch/build.sh +++ b/packages/python-torch/build.sh @@ -3,12 +3,14 @@ TERMUX_PKG_DESCRIPTION="Tensors and Dynamic neural networks in Python" TERMUX_PKG_LICENSE="BSD 3-Clause" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="2.6.0" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=git+https://github.com/pytorch/pytorch TERMUX_PKG_UPDATE_TAG_TYPE="latest-release-tag" -TERMUX_PKG_DEPENDS="libc++, libopenblas, libprotobuf, python, python-numpy, python-pip" +TERMUX_PKG_DEPENDS="libc++, libopenblas, libprotobuf, python, python-numpy" TERMUX_PKG_BUILD_DEPENDS="vulkan-headers, vulkan-loader-android" TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, pyyaml, typing_extensions" +TERMUX_PKG_PYTHON_RUNTIME_DEPS="torch" TERMUX_PKG_PYTHON_BUILD_DEPS="numpy" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" @@ -36,12 +38,14 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DUSE_VULKAN=ON -DANDROID_NDK=${NDK} -DANDROID_NDK_HOST_SYSTEM_NAME=linux-$HOSTTYPE +-DCMAKE_POLICY_VERSION_MINIMUM=3.5 " TERMUX_PKG_RM_AFTER_INSTALL=" lib/pkgconfig lib/cmake/fmt lib/libfmt.a +include/fmt " termux_step_host_build() { @@ -79,11 +83,5 @@ termux_step_make_install() { export PYTORCH_BUILD_VERSION=${TERMUX_PKG_VERSION} export PYTORCH_BUILD_NUMBER=0 pip -v install --no-deps --no-build-isolation --prefix $TERMUX_PREFIX "$TERMUX_PKG_SRCDIR" - ln -sr ${TERMUX_PYTHON_HOME}/site-packages/torch/lib/*.so ${TERMUX_PREFIX}/lib -} - -termux_step_create_debscripts() { - echo "#!$TERMUX_PREFIX/bin/sh" > postinst - echo "echo 'Installing dependencies for $TERMUX_PKG_NAME...'" >> postinst - echo "pip3 install torch" >> postinst + ln -sfr ${TERMUX_PYTHON_HOME}/site-packages/torch/lib/*.so ${TERMUX_PREFIX}/lib } diff --git a/packages/python-torchvision/build.sh b/packages/python-torchvision/build.sh index cd3f17410852149..20126a291cd92fd 100644 --- a/packages/python-torchvision/build.sh +++ b/packages/python-torchvision/build.sh @@ -3,11 +3,12 @@ TERMUX_PKG_DESCRIPTION="Datasets, Transforms and Models specific to Computer Vis TERMUX_PKG_LICENSE="BSD 3-Clause" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=0.21.0 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 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_DEPENDS="libc++, ffmpeg, python, python-numpy, python-pillow, python-torch, libjpeg-turbo, libpng, libwebp, zlib" TERMUX_PKG_SETUP_PYTHON=true +TERMUX_PKG_PYTHON_RUNTIME_DEPS="torchvision" termux_step_pre_configure() { CXXFLAGS+=" -I${TERMUX_PYTHON_HOME}/site-packages/torch/include" @@ -33,9 +34,3 @@ 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 -} diff --git a/packages/python-xlib/build.sh b/packages/python-xlib/build.sh index ec4973af116d2ce..0e9bafc7997a547 100644 --- a/packages/python-xlib/build.sh +++ b/packages/python-xlib/build.sh @@ -3,20 +3,12 @@ TERMUX_PKG_DESCRIPTION="The Python X Library" TERMUX_PKG_LICENSE="LGPL-2.1" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=0.33 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=https://github.com/python-xlib/python-xlib/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=e10d1b49655800bffe0fbb5eb31eeef915a4421952ef006d468d53d34901f6f8 TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="python, python-pip" +TERMUX_PKG_DEPENDS="python" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" TERMUX_PKG_PYTHON_TARGET_DEPS="'six>=1.10.0'" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip. This may take a while..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/python-yt-dlp/build.sh b/packages/python-yt-dlp/build.sh index 157db3b5a044c7c..279af1cffaee33e 100644 --- a/packages/python-yt-dlp/build.sh +++ b/packages/python-yt-dlp/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="A youtube-dl fork with additional features and fixes" TERMUX_PKG_LICENSE="Unlicense" TERMUX_PKG_MAINTAINER="Joshua Kahn @TomJo2000" TERMUX_PKG_VERSION="2025.07.21" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/yt-dlp/yt-dlp/archive/refs/tags/$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=04732b85bb56e107f6a718cdfcd069a152c86e87b9ca9606383555e0c65f78dc TERMUX_PKG_DEPENDS="libc++, libexpat, openssl, python, python-brotli, python-pip, python-pycryptodomex" @@ -36,11 +37,3 @@ termux_step_make_install() { install -Dm600 $TERMUX_PKG_HOSTBUILD_DIR/src/completions/fish/yt-dlp.fish \ -t "$TERMUX_PREFIX"/share/fish/completions } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/rdiff-backup/build.sh b/packages/rdiff-backup/build.sh index bed83b9a5102425..e65fede067add18 100644 --- a/packages/rdiff-backup/build.sh +++ b/packages/rdiff-backup/build.sh @@ -3,22 +3,15 @@ TERMUX_PKG_DESCRIPTION="A utility for local/remote mirroring and incremental bac TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="2.2.6" -TERMUX_PKG_REVISION=2 +TERMUX_PKG_REVISION=3 TERMUX_PKG_SRCURL=https://github.com/rdiff-backup/rdiff-backup/releases/download/v${TERMUX_PKG_VERSION/\~/}/rdiff-backup-${TERMUX_PKG_VERSION/\~/}.tar.gz TERMUX_PKG_SHA256=d0778357266bc6513bb7f75a4570b29b24b2760348bbf607babfc3a6f09458cf TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_DEPENDS="librsync, python" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" +TERMUX_PKG_PYTHON_RUNTIME_DEPS="pyyaml" TERMUX_PKG_BUILD_IN_SRC=true termux_step_make() { continue } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install pyyaml - EOF -} diff --git a/packages/rdircd/build.sh b/packages/rdircd/build.sh index cbe13f863ec159e..b70dfe30512edc4 100644 --- a/packages/rdircd/build.sh +++ b/packages/rdircd/build.sh @@ -4,12 +4,12 @@ TERMUX_PKG_LICENSE="WTFPL" TERMUX_PKG_MAINTAINER="@termux" _COMMIT=026f1aef9857ae6ce06bfb00860898e6113adfc0 TERMUX_PKG_VERSION=2023.02.07 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=git+https://github.com/mk-fg/reliable-discord-client-irc-daemon TERMUX_PKG_SHA256=c2cc88d6e1616d27f6f7849d536ba7613c7f13f0d16cac6022f9b1952ad537e2 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_GIT_BRANCH=master -TERMUX_PKG_DEPENDS="python, python-pip" +TERMUX_PKG_DEPENDS="python" TERMUX_PKG_PYTHON_TARGET_DEPS="aiohttp" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true @@ -34,11 +34,3 @@ termux_step_post_get_source() { termux_step_make_install() { install -Dm700 -t $TERMUX_PREFIX/bin rdircd } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS} - EOF -} diff --git a/packages/sabnzbd/build.sh b/packages/sabnzbd/build.sh index ccd8c6049bdb45a..97a98d5683369f5 100644 --- a/packages/sabnzbd/build.sh +++ b/packages/sabnzbd/build.sh @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="GPL-2.0, GPL-3.0" TERMUX_PKG_LICENSE_FILE="LICENSE.txt, GPL2.txt, GPL3.txt" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="4.5.2" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/sabnzbd/sabnzbd/releases/download/${TERMUX_PKG_VERSION}/SABnzbd-${TERMUX_PKG_VERSION}-src.tar.gz TERMUX_PKG_SHA256=c1867f35597c6f1b4235c9a478f3c67545a2b9d7d3df8404a21f70f921d5f644 TERMUX_PKG_AUTO_UPDATE=true @@ -38,11 +39,3 @@ termux_step_make_install() { install -Dm700 SABnzbd.py "${TERMUX_PREFIX}/bin/sabnzbd" install -Dm600 linux/sabnzbd.bash-completion "${TERMUX_PREFIX}/share/bash-completion/completions/sabnzbd" } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/srt2vobsub/build.sh b/packages/srt2vobsub/build.sh index 624b3c4881d795b..e97904d71fb8148 100644 --- a/packages/srt2vobsub/build.sh +++ b/packages/srt2vobsub/build.sh @@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="A command-line tool that generates a pair of .idx/.sub s TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=1.0 -TERMUX_PKG_REVISION=4 +TERMUX_PKG_REVISION=5 TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/srt2vobsub/srt2vobsub-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=5f59319b300dc8629adf6debf94529f3f71ad8cc34bad5ead53a3cfc8d613c12 -TERMUX_PKG_DEPENDS="bdsup2sub, ffmpeg, fontconfig-utils, imagemagick, mediainfo, python, python-pip" +TERMUX_PKG_DEPENDS="bdsup2sub, ffmpeg, fontconfig-utils, imagemagick, mediainfo, python" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_PYTHON_TARGET_DEPS="chardet, srt, wand" @@ -17,11 +17,3 @@ termux_step_make_install() { install -Dm600 -t $TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME \ README defaults.conf langcodes.txt srt2vobsub.html } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} diff --git a/packages/termux-gui-package/build.sh b/packages/termux-gui-package/build.sh index f4947caec0e55a5..b59c0ac6b2b97e2 100644 --- a/packages/termux-gui-package/build.sh +++ b/packages/termux-gui-package/build.sh @@ -3,8 +3,8 @@ TERMUX_PKG_DESCRIPTION="A Termux package containing utilities for Termux:GUI" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@tareksander" TERMUX_PKG_VERSION="0.1.6" -TERMUX_PKG_REVISION=2 -TERMUX_PKG_DEPENDS="python, python-pip" +TERMUX_PKG_REVISION=3 +TERMUX_PKG_DEPENDS="python" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_SRCURL="https://github.com/tareksander/termux-gui-package/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz" @@ -12,11 +12,3 @@ TERMUX_PKG_SHA256="79a231f6550bde39c0bdd4eca0fce91b21df9c817345072c4859567437e48 TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag" TERMUX_PKG_PYTHON_TARGET_DEPS="termuxgui" - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!${TERMUX_PREFIX}/bin/sh - echo "Installing python bindings for Termux:GUI" - pip3 install --upgrade $TERMUX_PKG_PYTHON_TARGET_DEPS - EOF -} diff --git a/packages/termux-gui-pm/build.sh b/packages/termux-gui-pm/build.sh index dc7c7bea1651c58..a6bf693d52467c0 100644 --- a/packages/termux-gui-pm/build.sh +++ b/packages/termux-gui-pm/build.sh @@ -3,8 +3,8 @@ TERMUX_PKG_DESCRIPTION="A graphical package manager for various package formats TERMUX_PKG_LICENSE="MPL-2.0" TERMUX_PKG_MAINTAINER="@tareksander" TERMUX_PKG_VERSION="1.0.0" -TERMUX_PKG_REVISION=2 -TERMUX_PKG_DEPENDS="python, python-pip" +TERMUX_PKG_REVISION=3 +TERMUX_PKG_DEPENDS="python" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_SRCURL="https://github.com/tareksander/termux-gui-pm/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz" @@ -12,11 +12,3 @@ TERMUX_PKG_SHA256="3a5a829b721d17f2002406571852e63d1984acc9732e58f2f76a296638129 TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag" TERMUX_PKG_PYTHON_TARGET_DEPS="termuxgui" - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!${TERMUX_PREFIX}/bin/sh - echo "Installing python bindings for Termux:GUI" - pip3 install --upgrade $TERMUX_PKG_PYTHON_TARGET_DEPS - EOF -} diff --git a/packages/units/build.sh b/packages/units/build.sh index 2f46c24e0f05565..b7bdb8b9fbc3122 100644 --- a/packages/units/build.sh +++ b/packages/units/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Converts between different systems of units" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="2.24" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/units/units-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=1e502c4edfacf20b29284716c72e5ddb51a495a2365d7b03e7960494c4a0c902 TERMUX_PKG_DEPENDS="readline, libandroid-support" diff --git a/packages/units/units-cur.subpackage.sh b/packages/units/units-cur.subpackage.sh index 3e59112e80691bb..d0bb0b4b9b9827d 100644 --- a/packages/units/units-cur.subpackage.sh +++ b/packages/units/units-cur.subpackage.sh @@ -6,11 +6,4 @@ TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true TERMUX_SUBPKG_DEPENDS="python, python-pip" TERMUX_SUBPKG_BREAKS="units (<< 2.22)" TERMUX_SUBPKG_REPLACES="units (<< 2.22)" - -termux_step_create_subpkg_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install requests - EOF -} +TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="requests" diff --git a/packages/ytui-music/build.sh b/packages/ytui-music/build.sh index 46ff4e02f1aa8f1..2f70dbdfcdcd963 100644 --- a/packages/ytui-music/build.sh +++ b/packages/ytui-music/build.sh @@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="Youtube client in terminal for music" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=2.0.0-beta -TERMUX_PKG_REVISION=2 +TERMUX_PKG_REVISION=3 TERMUX_PKG_SRCURL=https://github.com/sudipghimire533/ytui-music/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=43deb6b3cb9eb836b7122ac2542106f46519f240f99a0af67eecdfa5b200cca7 -TERMUX_PKG_DEPENDS="libsqlite, mpv, openssl, python-pip" +TERMUX_PKG_DEPENDS="libsqlite, mpv, openssl, python-yt-dlp" TERMUX_PKG_BUILD_IN_SRC=true termux_step_pre_configure() { @@ -20,6 +20,8 @@ termux_step_pre_configure() { : "${CARGO_HOME:=$HOME/.cargo}" export CARGO_HOME + rm -rf "$CARGO_HOME"/registry/src/*/libmpv-* + cargo fetch --target $CARGO_TARGET_NAME local p="$TERMUX_PKG_CACHEDIR/ytui-music-libmpv-rs-mpv-0.35.0.patch" @@ -44,11 +46,3 @@ termux_step_make() { termux_step_make_install() { install -Dm700 -t $TERMUX_PREFIX/bin ../target/${CARGO_TARGET_NAME}/release/ytui_music } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install yt-dlp - EOF -} diff --git a/root-packages/frida/build.sh b/root-packages/frida/build.sh index feed206b7616208..1c446d32cb02a16 100644 --- a/root-packages/frida/build.sh +++ b/root-packages/frida/build.sh @@ -6,6 +6,7 @@ _MAJOR_VERSION=17 _MINOR_VERSION=2 _MICRO_VERSION=14 TERMUX_PKG_VERSION=${_MAJOR_VERSION}.${_MINOR_VERSION}.${_MICRO_VERSION} +TERMUX_PKG_REVISION=1 TERMUX_PKG_GIT_BRANCH=$TERMUX_PKG_VERSION TERMUX_PKG_SRCURL=git+https://github.com/frida/frida TERMUX_PKG_AUTO_UPDATE=false diff --git a/root-packages/frida/frida-python.subpackage.sh b/root-packages/frida/frida-python.subpackage.sh index 63379d8a84a4fe3..398d55918b4feed 100644 --- a/root-packages/frida/frida-python.subpackage.sh +++ b/root-packages/frida/frida-python.subpackage.sh @@ -22,9 +22,4 @@ share/fish TERMUX_SUBPKG_DEPENDS="libandroid-support, python, python-pip" TERMUX_SUBPKG_CONFLICTS="frida-tools (<< 15.1.24)" TERMUX_SUBPKG_REPLACES="frida-tools (<< 15.1.24)" - -# See install_requires in https://github.com/frida/frida-tools/blob/main/setup.py -termux_step_create_subpkg_debscripts() { - echo "#!$TERMUX_PREFIX/bin/sh" > postinst - echo "pip${TERMUX_PYTHON_VERSION} install 'prompt-toolkit>=2.0.0,<4.0.0' 'colorama>=0.2.7,<1.0.0' 'pygments>=2.0.2,<3.0.0' 'websockets>=13.0.0,<14.0.0'" >> postinst -} +TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="'prompt-toolkit>=2.0.0,<4.0.0', 'colorama>=0.2.7,<1.0.0', 'pygments>=2.0.2,<3.0.0', 'websockets>=13.0.0,<14.0.0'" diff --git a/x11-packages/inkscape/build.sh b/x11-packages/inkscape/build.sh index b6a370bda59f0e5..4c3decae97ff4a3 100644 --- a/x11-packages/inkscape/build.sh +++ b/x11-packages/inkscape/build.sh @@ -15,6 +15,7 @@ LICENSES/OFL-1.1.txt " TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="1.4.2" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://media.inkscape.org/dl/resources/file/inkscape-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=2000530c7917e5260c9e8575a7154ff6926643d2006487d714e304a963f0c782 TERMUX_PKG_AUTO_UPDATE=true diff --git a/x11-packages/inkscape/inkscape-extensions.subpackage.sh b/x11-packages/inkscape/inkscape-extensions.subpackage.sh index 92180e2029a1623..6e61321717fa383 100644 --- a/x11-packages/inkscape/inkscape-extensions.subpackage.sh +++ b/x11-packages/inkscape/inkscape-extensions.subpackage.sh @@ -2,11 +2,4 @@ TERMUX_SUBPKG_INCLUDE="share/inkscape/extensions" TERMUX_SUBPKG_DESCRIPTION="Inkscape extensions" TERMUX_SUBPKG_DEPENDS="python, python-numpy, python-pip, python-lxml" TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true - -termux_step_create_subpkg_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install scour - EOF -} +TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="scour" diff --git a/x11-packages/orca/build.sh b/x11-packages/orca/build.sh index 04e91a8596067e8..ba672b2dadbecf4 100644 --- a/x11-packages/orca/build.sh +++ b/x11-packages/orca/build.sh @@ -3,10 +3,11 @@ TERMUX_PKG_DESCRIPTION="A free, open source, flexible, and extensible screen rea TERMUX_PKG_LICENSE="LGPL-2.1" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="48.6" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://download.gnome.org/sources/orca/${TERMUX_PKG_VERSION%.*}/orca-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=edc50344e0dfd72476b5c14b3aa725ca268718ea6dd89bc4ee26f450b339d696 TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="at-spi2-core, glib, gst-python, gstreamer, gtk3, libwnck, pango, pyatspi, pygobject, python, python-pip, speechd" +TERMUX_PKG_DEPENDS="at-spi2-core, glib, gst-python, gstreamer, gtk3, libwnck, pango, pyatspi, pygobject, python, speechd" TERMUX_PKG_SETUP_PYTHON=true TERMUX_PKG_PYTHON_TARGET_DEPS="setproctitle" TERMUX_MESON_WHEEL_CROSSFILE="$TERMUX_PKG_TMPDIR/wheel-cross-file.txt" @@ -41,11 +42,3 @@ termux_step_configure() { termux_step_configure_meson } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install $TERMUX_PKG_PYTHON_TARGET_DEPS - EOF -} diff --git a/x11-packages/pyqt5/build.sh b/x11-packages/pyqt5/build.sh index a8c7f85783dbfb1..599d72d4e9eb630 100644 --- a/x11-packages/pyqt5/build.sh +++ b/x11-packages/pyqt5/build.sh @@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="Comprehensive Python Bindings for Qt v5" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="5.15.11" -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=https://files.pythonhosted.org/packages/source/P/PyQt5/PyQt5-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=fda45743ebb4a27b4b1a51c6d8ef455c4c1b5d610c90d2934c7802b5c1557c52 -TERMUX_PKG_DEPENDS="libc++, python, qt5-qtbase, qt5-qtdeclarative, qt5-qtlocation, qt5-qtmultimedia, qt5-qtsensors, qt5-qtsvg, qt5-qttools, qt5-qtwebchannel, qt5-qtwebsockets, qt5-qtx11extras, qt5-qtxmlpatterns, python-pip" +TERMUX_PKG_DEPENDS="libc++, python, qt5-qtbase, qt5-qtdeclarative, qt5-qtlocation, qt5-qtmultimedia, qt5-qtsensors, qt5-qtsvg, qt5-qttools, qt5-qtwebchannel, qt5-qtwebsockets, qt5-qtx11extras, qt5-qtxmlpatterns" TERMUX_PKG_BUILD_DEPENDS="qt5-qtbase-cross-tools, qt5-qtdeclarative-cross-tools, qt5-qttools-cross-tools" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, 'sip>=6.6.2,<7', 'PyQt-builder>=1.14.1,<2'" TERMUX_PKG_PYTHON_TARGET_DEPS="'PyQt5-sip>=12.13,<13'" @@ -67,11 +67,3 @@ termux_step_make_install() { chmod 0700 "${t}" done } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip3 install $TERMUX_PKG_PYTHON_TARGET_DEPS - EOF -} diff --git a/x11-packages/xfce4-panel-profiles/build.sh b/x11-packages/xfce4-panel-profiles/build.sh index d5f0e730153e9f7..7785d86d435342d 100644 --- a/x11-packages/xfce4-panel-profiles/build.sh +++ b/x11-packages/xfce4-panel-profiles/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="A simple application to manage Xfce panel layouts." TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="1.1.1" -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=https://archive.xfce.org/src/apps/xfce4-panel-profiles/${TERMUX_PKG_VERSION%.*}/xfce4-panel-profiles-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=0126373a03778bb4894afa151de28d36bfc563ddab96d3bd7c63962350d34ba2 TERMUX_PKG_AUTO_UPDATE=true @@ -27,11 +27,3 @@ termux_step_configure() { -e s,@COPYRIGHT_YEAR@,2025,g \ xfce4-panel-profiles.1.in > xfce4-panel-profiles.1 } - -termux_step_create_debscripts() { - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Installing dependencies through pip..." - pip install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / } - EOF -} From aa0b286e935f87b92920132dfeb4cd432fee0b23 Mon Sep 17 00:00:00 2001 From: Robert Kirkman Date: Fri, 25 Jul 2025 03:33:07 -0500 Subject: [PATCH 3/3] robertkirkman debpython temporary commit 3 --- .../calcurse/calcurse-caldav.subpackage.sh | 2 +- packages/matplotlib/build.sh | 1 - packages/python-brotli/build.sh | 4 +- packages/python-lxml/build.sh | 3 +- packages/python-onnxruntime/build.sh | 1 - packages/python-pycryptodomex/build.sh | 5 +- packages/python-tflite-runtime/build.sh | 10 +- packages/python-torch/build.sh | 1 - packages/python-torchaudio/build.sh | 5 +- packages/python-torchvision/build.sh | 1 - packages/rdiff-backup/build.sh | 1 - packages/ruff/python-ruff.subpackage.sh | 2 +- packages/units/units-cur.subpackage.sh | 2 +- .../frida/frida-python.subpackage.sh | 2 +- .../termux_step_create_python_debscripts.sh | 130 ++++++++++++------ scripts/build/termux_step_start_build.sh | 12 -- scripts/buildorder.py | 10 -- .../inkscape-extensions.subpackage.sh | 2 +- 18 files changed, 109 insertions(+), 85 deletions(-) diff --git a/packages/calcurse/calcurse-caldav.subpackage.sh b/packages/calcurse/calcurse-caldav.subpackage.sh index bea8a1c273f54f3..737ebd20b123f66 100644 --- a/packages/calcurse/calcurse-caldav.subpackage.sh +++ b/packages/calcurse/calcurse-caldav.subpackage.sh @@ -1,6 +1,6 @@ TERMUX_SUBPKG_INCLUDE="bin/calcurse-caldav" TERMUX_SUBPKG_DESCRIPTION="Sync calcurse with remote caldav calendar" -TERMUX_SUBPKG_DEPENDS="python, python-pip" +TERMUX_SUBPKG_DEPENDS="python" TERMUX_SUBPKG_REPLACES="calcurse (<< 4.7.1-1)" TERMUX_SUBPKG_BREAKS="calcurse (<< 4.7.1-1)" TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="httplib2" diff --git a/packages/matplotlib/build.sh b/packages/matplotlib/build.sh index 30001a293d3e2e9..c395ef7658df570 100644 --- a/packages/matplotlib/build.sh +++ b/packages/matplotlib/build.sh @@ -22,7 +22,6 @@ TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_DEPENDS="freetype, libc++, patchelf, ninja, python, python-contourpy, python-numpy, python-pillow" _NUMPY_VERSION=$(. $TERMUX_SCRIPTDIR/packages/python-numpy/build.sh; echo $TERMUX_PKG_VERSION) TERMUX_PKG_PYTHON_COMMON_DEPS="build, 'meson-python>=0.13.1', wheel, 'numpy==$_NUMPY_VERSION', 'pybind11>=2.6.0', 'setuptools>=64', 'setuptools_scm>=7'" -TERMUX_PKG_PYTHON_RUNTIME_DEPS="matplotlib" TERMUX_MESON_WHEEL_CROSSFILE="$TERMUX_PKG_TMPDIR/wheel-cross-file.txt" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" diff --git a/packages/python-brotli/build.sh b/packages/python-brotli/build.sh index 452af7b93f96d05..c9eb0ff9ac95670 100644 --- a/packages/python-brotli/build.sh +++ b/packages/python-brotli/build.sh @@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="lossless compression algorithm and format (Python bindin TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=1.1.0 -TERMUX_PKG_REVISION=3 +TERMUX_PKG_REVISION=4 TERMUX_PKG_SRCURL=https://github.com/google/brotli/archive/v$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff -TERMUX_PKG_DEPENDS="python, python-pip" +TERMUX_PKG_DEPENDS="python" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_AUTO_UPDATE=true diff --git a/packages/python-lxml/build.sh b/packages/python-lxml/build.sh index 8f2072ed7424514..2e839a97c4db6ec 100644 --- a/packages/python-lxml/build.sh +++ b/packages/python-lxml/build.sh @@ -3,9 +3,10 @@ TERMUX_PKG_DESCRIPTION="Python binding for the libxml2 and libxslt libraries" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="6.0.0" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/lxml/lxml/releases/download/lxml-$TERMUX_PKG_VERSION/lxml-$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=032e65120339d44cdc3efc326c9f660f5f7205f3a535c1fdbf898b29ea01fb72 -TERMUX_PKG_DEPENDS="libxml2, libxslt, python, python-pip" +TERMUX_PKG_DEPENDS="libxml2, libxslt, python" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_AUTO_UPDATE=true diff --git a/packages/python-onnxruntime/build.sh b/packages/python-onnxruntime/build.sh index 3affdf34d26a04d..8de8d4a9e3ba506 100644 --- a/packages/python-onnxruntime/build.sh +++ b/packages/python-onnxruntime/build.sh @@ -9,7 +9,6 @@ TERMUX_PKG_DEPENDS="abseil-cpp, libc++, protobuf, libre2, python" TERMUX_PKG_BUILD_DEPENDS="python-numpy" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, build, packaging" -TERMUX_PKG_PYTHON_RUNTIME_DEPS="onnxruntime" TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_UPDATE_TAG_TYPE="latest-release-tag" diff --git a/packages/python-pycryptodomex/build.sh b/packages/python-pycryptodomex/build.sh index 2fa2c9540b533bc..fdd7ffa87c8304c 100644 --- a/packages/python-pycryptodomex/build.sh +++ b/packages/python-pycryptodomex/build.sh @@ -4,10 +4,11 @@ TERMUX_PKG_LICENSE="BSD 2-Clause, Public Domain" TERMUX_PKG_LICENSE_FILE="LICENSE.rst" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="3.23.0" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL="https://github.com/Legrandin/pycryptodome/archive/refs/tags/v${TERMUX_PKG_VERSION}x.tar.gz" TERMUX_PKG_SHA256=d3e12d349f62a8c3bd2e7056e2eea925abcfcdd9e2b07bff091bcc05837ac869 -TERMUX_PKG_DEPENDS="python, python-pip" -TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" +TERMUX_PKG_DEPENDS="python" +TERMUX_PKG_SETUP_PYTHON=true TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_AUTO_UPDATE=true diff --git a/packages/python-tflite-runtime/build.sh b/packages/python-tflite-runtime/build.sh index a6c7a9d1ae82f62..41dadc8ed83a740 100644 --- a/packages/python-tflite-runtime/build.sh +++ b/packages/python-tflite-runtime/build.sh @@ -3,20 +3,22 @@ TERMUX_PKG_DESCRIPTION="TensorFlow Lite Python bindings" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="2.19.0" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=git+https://github.com/tensorflow/tensorflow TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="python, python-numpy, python-pip" +TERMUX_PKG_DEPENDS="python, python-numpy" TERMUX_PKG_UPDATE_TAG_TYPE="latest-release-tag" TERMUX_PKG_PYTHON_COMMON_DEPS="setuptools, wheel, pybind11" TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DTFLITE_HOST_TOOLS_DIR=$TERMUX_PKG_HOSTBUILD_DIR " termux_step_host_build() { termux_setup_cmake - cmake "$TERMUX_PKG_SRCDIR"/tensorflow/lite + cmake "$TERMUX_PKG_SRCDIR"/tensorflow/lite -DCMAKE_POLICY_VERSION_MINIMUM=3.5 cmake --build . --verbose -j $TERMUX_PKG_MAKE_PROCESSES -t flatbuffers-flatc } @@ -34,7 +36,7 @@ termux_step_pre_configure() { local BUILD_DIR="$TFLITE_BUILD_DIR" local PYTHON="$(command -v python)" local PYBIND11_INCLUDE=$($PYTHON -c "import pybind11; print (pybind11.get_include())") - CPPFLAGS+=" -I$PYTHON_SITE_PKG/numpy/_core/include" + CPPFLAGS+=" -I$TERMUX_PYTHON_HOME/site-packages/numpy/_core/include" CPPFLAGS+=" -I$PYBIND11_INCLUDE" CPPFLAGS+=" -I$TERMUX_PREFIX/include/python$TERMUX_PYTHON_VERSION" @@ -74,5 +76,5 @@ termux_step_make() { termux_step_make_install() { local _pyver="${TERMUX_PYTHON_VERSION//./}" local _wheel="tflite_runtime-${TERMUX_PKG_VERSION}-cp${_pyver}-cp${_pyver}-linux_${TERMUX_ARCH}.whl" - pip install --no-deps --prefix="$TERMUX_PREFIX" "$TFLITE_BUILD_DIR/dist/${_wheel}" + pip install --force-reinstall --no-deps --prefix="$TERMUX_PREFIX" "$TFLITE_BUILD_DIR/dist/${_wheel}" } diff --git a/packages/python-torch/build.sh b/packages/python-torch/build.sh index da414d093c77023..c7ca675324616a0 100644 --- a/packages/python-torch/build.sh +++ b/packages/python-torch/build.sh @@ -10,7 +10,6 @@ TERMUX_PKG_DEPENDS="libc++, libopenblas, libprotobuf, python, python-numpy" TERMUX_PKG_BUILD_DEPENDS="vulkan-headers, vulkan-loader-android" TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, pyyaml, typing_extensions" -TERMUX_PKG_PYTHON_RUNTIME_DEPS="torch" TERMUX_PKG_PYTHON_BUILD_DEPS="numpy" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" diff --git a/packages/python-torchaudio/build.sh b/packages/python-torchaudio/build.sh index 50700f18f23d4e6..aa9eb6a4750525c 100644 --- a/packages/python-torchaudio/build.sh +++ b/packages/python-torchaudio/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Data manipulation and transformation for audio signal pr TERMUX_PKG_LICENSE="BSD 2-Clause" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=2.6.0 +TERMUX_PKG_REVISION=1 # FFmpeg 7 is not yet supported. The subpackage should be removed when FFmpeg 7 # is supported by an upstream release. # https://github.com/pytorch/audio/issues/3857 @@ -17,8 +18,8 @@ TERMUX_PKG_SRCURL=(https://github.com/pytorch/audio/archive/refs/tags/v${TERMUX_ $_FFMPEG_SRCURL) TERMUX_PKG_SHA256=(3335d8fcf58c26acf3c628d751103b59226e01c91847ce56efb2a4e7ae8351ef 3b624649725ecdc565c903ca6643d41f33bd49239922e45c9b1442c63dca4e38) -TERMUX_PKG_DEPENDS="libc++, python, python-pip, python-torch, torchaudio-ffmpeg" -TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, setuptools" +TERMUX_PKG_DEPENDS="libc++, python, python-torch, torchaudio-ffmpeg" +TERMUX_PKG_SETUP_PYTHON=true TERMUX_PKG_RM_AFTER_INSTALL=$_FFMPEG_RM_AFTER_INSTALL _ffmpeg_configure_make_install() { diff --git a/packages/python-torchvision/build.sh b/packages/python-torchvision/build.sh index 20126a291cd92fd..5c59a85f4fe55c0 100644 --- a/packages/python-torchvision/build.sh +++ b/packages/python-torchvision/build.sh @@ -8,7 +8,6 @@ TERMUX_PKG_SRCURL=https://github.com/pytorch/vision/archive/refs/tags/v${TERMUX_ TERMUX_PKG_SHA256=0a4a967bbb7f9810f792cd0289a07fb98c8fb5d1303fae8b63e3a6b05d720058 TERMUX_PKG_DEPENDS="libc++, ffmpeg, python, python-numpy, python-pillow, python-torch, libjpeg-turbo, libpng, libwebp, zlib" TERMUX_PKG_SETUP_PYTHON=true -TERMUX_PKG_PYTHON_RUNTIME_DEPS="torchvision" termux_step_pre_configure() { CXXFLAGS+=" -I${TERMUX_PYTHON_HOME}/site-packages/torch/include" diff --git a/packages/rdiff-backup/build.sh b/packages/rdiff-backup/build.sh index e65fede067add18..d60f9e4b19621a5 100644 --- a/packages/rdiff-backup/build.sh +++ b/packages/rdiff-backup/build.sh @@ -9,7 +9,6 @@ TERMUX_PKG_SHA256=d0778357266bc6513bb7f75a4570b29b24b2760348bbf607babfc3a6f09458 TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_DEPENDS="librsync, python" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" -TERMUX_PKG_PYTHON_RUNTIME_DEPS="pyyaml" TERMUX_PKG_BUILD_IN_SRC=true termux_step_make() { diff --git a/packages/ruff/python-ruff.subpackage.sh b/packages/ruff/python-ruff.subpackage.sh index 18baa540ed61435..7e113f354dce744 100644 --- a/packages/ruff/python-ruff.subpackage.sh +++ b/packages/ruff/python-ruff.subpackage.sh @@ -1,3 +1,3 @@ TERMUX_SUBPKG_DESCRIPTION="An extremely fast Python linter, written in Rust (Python bindings)" TERMUX_SUBPKG_INCLUDE="lib/python${TERMUX_PYTHON_VERSION}/site-packages" -TERMUX_SUBPKG_DEPENDS="python, python-pip" +TERMUX_SUBPKG_DEPENDS="python" diff --git a/packages/units/units-cur.subpackage.sh b/packages/units/units-cur.subpackage.sh index d0bb0b4b9b9827d..27cfbf2922059f9 100644 --- a/packages/units/units-cur.subpackage.sh +++ b/packages/units/units-cur.subpackage.sh @@ -3,7 +3,7 @@ TERMUX_SUBPKG_INCLUDE=" bin/units_cur " TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true -TERMUX_SUBPKG_DEPENDS="python, python-pip" +TERMUX_SUBPKG_DEPENDS="python" TERMUX_SUBPKG_BREAKS="units (<< 2.22)" TERMUX_SUBPKG_REPLACES="units (<< 2.22)" TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="requests" diff --git a/root-packages/frida/frida-python.subpackage.sh b/root-packages/frida/frida-python.subpackage.sh index 398d55918b4feed..383645e64225859 100644 --- a/root-packages/frida/frida-python.subpackage.sh +++ b/root-packages/frida/frida-python.subpackage.sh @@ -19,7 +19,7 @@ lib/python* share/gir-1.0 share/fish " -TERMUX_SUBPKG_DEPENDS="libandroid-support, python, python-pip" +TERMUX_SUBPKG_DEPENDS="libandroid-support, python" TERMUX_SUBPKG_CONFLICTS="frida-tools (<< 15.1.24)" TERMUX_SUBPKG_REPLACES="frida-tools (<< 15.1.24)" TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="'prompt-toolkit>=2.0.0,<4.0.0', 'colorama>=0.2.7,<1.0.0', 'pygments>=2.0.2,<3.0.0', 'websockets>=13.0.0,<14.0.0'" diff --git a/scripts/build/termux_step_create_python_debscripts.sh b/scripts/build/termux_step_create_python_debscripts.sh index ca4688202b7a286..d32837c4bca7dac 100644 --- a/scripts/build/termux_step_create_python_debscripts.sh +++ b/scripts/build/termux_step_create_python_debscripts.sh @@ -1,36 +1,42 @@ termux_step_create_python_debscripts() { if [[ -n "${SUB_PKG_NAME-}" ]]; then local _package_name="$SUB_PKG_NAME" - local _package_massagedir="$SUB_PKG_DIR/massage/$TERMUX_PREFIX" + local _package_python_home="$SUB_PKG_DIR/massage$TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION" local _package_python_deps="${TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS//, / }" else local _package_name="$TERMUX_PKG_NAME" - local _package_massagedir="$TERMUX_PKG_MASSAGEDIR$TERMUX_PREFIX" + local _package_python_home="$TERMUX_PKG_MASSAGEDIR$TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION" local _package_python_deps="${TERMUX_PKG_PYTHON_RUNTIME_DEPS//, / }" fi + local py_file_in_lib_python="" pip_metadata_file="" + # if the package does not contain any .py files in # $TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION, # then debpython (py3compile and py3clean) are not # necessary or not currently supported for this package - local contains_py_files_in_lib_python=false - - if [[ -d "$_package_massagedir/lib/python$TERMUX_PYTHON_VERSION/" ]]; then - local py_file_in_lib_python="$(find \ - "$_package_massagedir/lib/python$TERMUX_PYTHON_VERSION/" \ - -name "*.py" -print -quit)" - if [[ -n "$py_file_in_lib_python" ]]; then - contains_py_files_in_lib_python=true - fi + if [[ -d "$_package_python_home" ]]; then + py_file_in_lib_python="$(find "$_package_python_home" -name "*.py" -print -quit)" + fi + + # metadata file that at least some packages have, which contains the 'pip'-facing name of the + # package and any PyPi dependencies it has. + if [[ -d "$_package_python_home/site-packages" ]]; then + pip_metadata_file="$(find "$_package_python_home/site-packages" -name "METADATA" -print -quit)" + fi + + # add the internal 'pip'-facing name of the package to the 'pip install' dependencies if it exists, + # which will install all the dependencies from PyPi that the software marks itself as depending on. + # if more than one 'METADATA' file is detected, this condition will evaluate false so nothing will happen. + if [[ -f "$pip_metadata_file" ]]; then + local package_pip_name="$(grep 'Name:' "$pip_metadata_file" | cut -d' ' -f2)" + _package_python_deps+=" $package_pip_name" fi # if there are no .py files in $TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION/, - # and the package either is a subpackage or has an empty $_package_python_deps, - # then this function does not need to do anything - if [[ "$contains_py_files_in_lib_python" == "false" ]]; then - if [[ -n "${SUB_PKG_NAME-}" || -z "${_package_python_deps}" ]]; then - return - fi + # and the package has an empty $_package_python_deps, then this function does not need to do anything + if [[ -z "$py_file_in_lib_python" ]] && [[ -z "${_package_python_deps}" ]]; then + return fi # if a postinst script does not already exist, create a new one @@ -38,7 +44,7 @@ termux_step_create_python_debscripts() { # as its last line, remove that line so that it does not # prevent execution of the additional commands if [[ ! -f postinst ]]; then - echo "#!${TERMUX_PREFIX_CLASSICAL}/bin/sh" > postinst + echo "#!${TERMUX_PREFIX_CLASSICAL}/bin/sh" >postinst chmod 0755 postinst elif tail -n1 postinst | grep -q 'exit 0'; then sed -i '$d' postinst @@ -47,38 +53,70 @@ termux_step_create_python_debscripts() { # if the package format is .deb, only run the script # if the package is being configured (not failed) if [[ "$TERMUX_PACKAGE_FORMAT" == "debian" ]]; then - cat <<- POSTINST_EOF >> postinst - if [ "\$1" != "configure" ]; then - exit 0 - fi + cat <<-POSTINST_EOF >>postinst + if [ "\$1" != "configure" ]; then + exit 0 + fi POSTINST_EOF fi # if the package has runtime dependencies requiring pip, # make this script install them if [[ -n "${_package_python_deps}" ]]; then - local upgrade_flag="--upgrade" - if [[ " $(tr ' ' '\n' <<< "${_package_python_deps}" | sed "s/'//g; s// /g; s/=/ /g" | awk '{printf $1 " "}')" =~ " ${_package_name//python-/} " ]]; then + local pip_package_name="python-pip" upgrade_flag="--upgrade" + + if [[ "$TERMUX_PACKAGE_LIBRARY" == "glibc" ]]; then + pip_package_name+="-glibc" + fi + + # if the list of dependencies to install from PyPi has the name of + # the current package with any 'python-' prefix stripped from it anywhere in it, + # do not use the '--upgrade' argument to pip, in order to avoid overwriting + # the non-PyPi local package files with a different software with the same name, + # or the same package of an incorrect version, from PyPi. + # this is particularly important for the 'nala' package, for example. + if [[ " $(tr ' ' '\n' <<<"${_package_python_deps}" | sed "s/'//g; s// /g; s/=/ /g" | awk '{printf $1 " "}')" =~ " ${_package_name//python-/} " ]]; then upgrade_flag="" fi - cat <<- POSTINST_EOF >> postinst - echo "Installing dependencies for ${_package_name} through pip..." - LD_PRELOAD='' LDFLAGS="-lpython$TERMUX_PYTHON_VERSION" MATHLIB="m" "${TERMUX_PREFIX}/bin/pip3" install ${upgrade_flag} ${_package_python_deps} + + cat <<-POSTINST_EOF >>postinst + echo "Installing dependencies for ${_package_name} through pip..." + LD_PRELOAD='' LDFLAGS="-lpython$TERMUX_PYTHON_VERSION" MATHLIB="m" "${TERMUX_PREFIX}/bin/pip3" install ${upgrade_flag} ${_package_python_deps} POSTINST_EOF + + # ensure that pip is added as a runtime-only dependency to all, and only to all + # packages that run the '$PREFIX/bin/pip' command. + if [[ "$TERMUX_PACKAGE_FORMAT" == "debian" ]]; then + if grep -q 'Depends: ' control; then + sed -i "s|Depends: |Depends: $pip_package_name, |" control + else + echo "Depends: $pip_package_name" >>control + fi + elif [[ "$TERMUX_PACKAGE_FORMAT" == "pacman" ]]; then + echo "depend = $pip_package_name" >>.PKGINFO + fi fi # if the package does not contain any .py files in # $TERMUX_PREFIX/lib/python$TERMUX_PYTHON_VERSION, # then this function does not need to do anything else - if [[ "$contains_py_files_in_lib_python" == "false" ]]; then + if [[ -z "$py_file_in_lib_python" ]]; then return fi # post-inst script to generate *.pyc files - cat <<- POSTINST_EOF >> postinst - if [ -f "${TERMUX_PREFIX}/bin/py3compile" ]; then - LD_PRELOAD='' "${TERMUX_PREFIX}/bin/py3compile" -p "$_package_name" "${TERMUX_PREFIX}/lib/python${TERMUX_PYTHON_VERSION}/" - fi + cat <<-POSTINST_EOF >>postinst + if [ -f "${TERMUX_PREFIX}/bin/py3compile" ]; then + LD_PRELOAD='' "${TERMUX_PREFIX}/bin/py3compile" -p "$_package_name" "${TERMUX_PREFIX}/lib/python${TERMUX_PYTHON_VERSION}/" + fi + POSTINST_EOF + + # make the last command of the postinst script 'exit 0' + # because if the previous last command was a condition, + # and the condition failed, then the postinst script could + # fail, which would not actually be the desired result + cat <<-POSTINST_EOF >>postinst + exit 0 POSTINST_EOF # if a prerm script does not already exist, create a new one @@ -86,7 +124,7 @@ termux_step_create_python_debscripts() { # as its last line, remove that line so that it does not # prevent execution of the additional commands if [[ ! -f prerm ]]; then - echo "#!${TERMUX_PREFIX_CLASSICAL}/bin/sh" > prerm + echo "#!${TERMUX_PREFIX_CLASSICAL}/bin/sh" >prerm chmod 0755 prerm elif tail -n1 prerm | grep -q 'exit 0'; then sed -i '$d' prerm @@ -95,22 +133,30 @@ termux_step_create_python_debscripts() { # if the package format is .deb, only run the script # if the package is being removed (not failed) if [[ "$TERMUX_PACKAGE_FORMAT" == "debian" ]]; then - cat <<- PRERM_EOF >> prerm - if [ "\$1" != "remove" ]; then - exit 0 - fi + cat <<-PRERM_EOF >>prerm + if [ "\$1" != "remove" ]; then + exit 0 + fi PRERM_EOF fi # pre-rm script to cleanup runtime-generated files. - cat <<- PRERM_EOF >> prerm - if [ -f "${TERMUX_PREFIX}/bin/py3clean" ]; then - LD_PRELOAD='' "${TERMUX_PREFIX}/bin/py3clean" -p "$_package_name" - fi + cat <<-PRERM_EOF >>prerm + if [ -f "${TERMUX_PREFIX}/bin/py3clean" ]; then + LD_PRELOAD='' "${TERMUX_PREFIX}/bin/py3clean" -p "$_package_name" + fi + PRERM_EOF + + # make the last command of the prerm script 'exit 0' + # because if the previous last command was a condition, + # and the condition failed, then the prerm script could + # fail, which would not actually be the desired result + cat <<-PRERM_EOF >>prerm + exit 0 PRERM_EOF # running py3compile in a package for pacman during a package update if [[ "$TERMUX_PACKAGE_FORMAT" == "pacman" ]] && ! grep -qs 'post_install' postupg; then - echo "post_install" >> postupg + echo "post_install" >>postupg fi } diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index 3d3930cb566b755..911e467652f4d53 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -28,18 +28,6 @@ termux_step_start_build() { if [ "$TERMUX_PKG_PYTHON_RUNTIME_DEPS" = "false" ]; then TERMUX_PKG_PYTHON_RUNTIME_DEPS="" fi - # Add python-pip{-glibc} dependency if plan to install python modules - if [ -n "$TERMUX_PKG_PYTHON_RUNTIME_DEPS" ]; then - local TERMUX_PKG_NAME_PIP="python-pip" - if [ "$TERMUX_PACKAGE_LIBRARY" = "glibc" ]; then - TERMUX_PKG_NAME_PIP+="-glibc" - fi - if [ -n "$TERMUX_PKG_DEPENDS" ]; then - TERMUX_PKG_DEPENDS+=", $TERMUX_PKG_NAME_PIP" - else - TERMUX_PKG_DEPENDS="$TERMUX_PKG_NAME_PIP" - fi - fi TERMUX_PKG_FULLVERSION=$TERMUX_PKG_VERSION if [ "$TERMUX_PKG_REVISION" != "0" ] || [ "$TERMUX_PKG_FULLVERSION" != "${TERMUX_PKG_FULLVERSION/-/}" ]; then diff --git a/scripts/buildorder.py b/scripts/buildorder.py index 01f2e072cf35363..88d37f138e54067 100755 --- a/scripts/buildorder.py +++ b/scripts/buildorder.py @@ -115,14 +115,6 @@ def __init__(self, dir_path, fast_build_mode): raise Exception("build.sh not found for package '" + self.name + "'") self.deps = parse_build_file_dependencies(build_sh_path) - py_deps = parse_build_file_dependencies_with_vars(build_sh_path, 'TERMUX_PKG_PYTHON_RUNTIME_DEPS') - if not py_deps: - py_deps = parse_build_file_dependencies_with_vars(build_sh_path, 'TERMUX_PKG_PYTHON_TARGET_DEPS') - elif len(py_deps) == list(py_deps).count("false"): - py_deps = set() - if py_deps: - self.deps.add(f"python-pip{'-glibc' if termux_pkg_library == 'glibc' else ''}") - self.antideps = parse_build_file_antidependencies(build_sh_path) self.excluded_arches = parse_build_file_excluded_arches(build_sh_path) self.only_installing = parse_build_file_variable_bool(build_sh_path, 'TERMUX_PKG_ONLY_INSTALLING') @@ -200,8 +192,6 @@ def __init__(self, subpackage_file_path, parent, virtual=False): self.excluded_arches = set() if not virtual: self.deps |= parse_build_file_dependencies(subpackage_file_path) - if parse_build_file_dependencies_with_vars(subpackage_file_path, 'TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS'): - self.deps.add(f"python-pip{'-glibc' if termux_pkg_library == 'glibc' else ''}") self.excluded_arches |= parse_build_file_excluded_arches(subpackage_file_path) self.dir = parent.dir diff --git a/x11-packages/inkscape/inkscape-extensions.subpackage.sh b/x11-packages/inkscape/inkscape-extensions.subpackage.sh index 6e61321717fa383..88a2848854942b2 100644 --- a/x11-packages/inkscape/inkscape-extensions.subpackage.sh +++ b/x11-packages/inkscape/inkscape-extensions.subpackage.sh @@ -1,5 +1,5 @@ TERMUX_SUBPKG_INCLUDE="share/inkscape/extensions" TERMUX_SUBPKG_DESCRIPTION="Inkscape extensions" -TERMUX_SUBPKG_DEPENDS="python, python-numpy, python-pip, python-lxml" +TERMUX_SUBPKG_DEPENDS="python, python-numpy, python-lxml" TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS="scour"