-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
tree-wide: port debpython to termux #23652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
tree-wide: port debpython to termux #23652
Conversation
|
This folder should only be excluded only when performing on-device build. In some packages, like python, this content in this folder is managed by apt. It is quite annoying to see some warnings like |
Should the content in these folders remain managed by apt in any case? In Debian, I believe these folders are not managed by https://packages.debian.org/sid/amd64/libpython3.12-minimal/filelist In Arch Linux, I believe these folders are managed by https://archlinux.org/packages/core/x86_64/python/ (file list) Fedora also ships them https://packages.fedoraproject.org/pkgs/python3.12/python3-libs/fedora-40.html it seems to me like it is optional whether to include them in the package, because I think Python can automatically generate them, but this problem is very difficult because, I think Arch Linux and Fedora might ship them for performance. At least this does not break Python, I think, because a
I do not think there is any way to get rid of this warning, because on Termux Example: warning always reproducible with current packages pkg install python-pip
pip install setuptools
pkg remove pythonThat happens without this change. Can you think of any way to:
I do not actually notice the performance difference at the startup of Python, when I try to test for it, but I believe someone else might. |
|
In Debain, they have a postinst script to compile the modules when new packages are installed, and a prerm script to clean up See |
eef60d2 to
7456b5b
Compare
ok I did it, is this what you meant? |
84e2f31 to
5d3a7a9
Compare
|
@Maxython now I have:
however, I am not sure whether the |
TomJo2000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting in the effort.
Looks like I accidentally created a merge conflict for you with one of my earlier PRs, sorry about that.
|
That's ok, However, the reason why many packages are marked with revision-bumps in this is because, that is marking all packages that a test I did indicates will have changed Because of that, I think probably what I need to do is split this into several PRs one after another that do not have CI disabled. |
5d3a7a9 to
cd049e3
Compare
9c780b7 to
e7253ee
Compare
5b68174 to
9266459
Compare
f1ec5dd to
8331f6f
Compare
c3ea7e4 to
5dbdaf6
Compare
|
@TomJo2000 Unfortunately, it seems like another problem related to has occurred in this PR, I rebased this PR past just now, and this happened: It seems to "think" that the current version is still Python 3.12.11-1, when it's definitely not. The current version is Python 3.12.12, and the diff shows that: Do you know what might be going wrong here? |
|
Looking into it. |
5dbdaf6 to
37a652a
Compare
|
I force-pushed the branch again with no other changes today, and now it's passing the linter instead of failing, so the problem is intermittent. This is the run where it failed: https://github.com/termux/termux-packages/actions/runs/18621788032/job/53093893130 I will watch in the future for if it happens again. |
2213234 to
bc68ffc
Compare
a0852ca to
660a198
Compare
0d6bb35 to
d3cf364
Compare
9761ccb to
a90eb2a
Compare
169a64c to
502a00e
Compare
- 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 <mixython@gmail.com>
502a00e to
43118ec
Compare
Fixes [Bug]: Conflicts:
asciidocandtinysparql#25921Fixes [Bug]: mesa & mesa-vulkan-icd-freedreno-dri3 build error #21658
Fixes [Bug]:
python-llvmliteconflict withlibllvm#25621What is debpython?
debpython is the commands
py3compileandpy3cleanfrom Debian. Iam calling them that because a large chunk of their source code is
found inside a folder inside Debian's source code named "debpython"
rather than packaging
.pycfiles into.debfiles,py3compileandpy3cleancan be called frompostinstandprermscripts togenerate all
.pycfor the.pyfiles in the package immediatelyafter the package is installed, and remove all
.pycfiles immediatelybefore 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 usingpip.Not implemented for
pypy,pypy3, orpython2packages, onlypython3packages currently.How to add a new Python package after this?
Everything is the same, except, now, this block is no longer necessary in
build.sh.scripts/build/termux_step_create_python_debscripts.shcan now detect the presence ofpippackage lists in$TERMUX_PKG_PYTHON_TARGET_DEPS,$TERMUX_SUBPKG_PYTHON_TARGET_DEPS, and theMETADATAfile of the Python package if it exists, and automatically insert them as a block into thepostinstscript for all relevant packages.$TERMUX_PKG_PYTHON_TARGET_DEPSis used forpipdependencies that are both on-device build-time and on-device run-time dependencies, and$TERMUX_PKG_PYTHON_RUNTIME_DEPSis used for runtime-onlypipdependencies.$TERMUX_PKG_PYTHON_RUNTIME_DEPSoverrides$TERMUX_PKG_PYTHON_TARGET_DEPSfor runtime dependencies,TERMUX_PKG_PYTHON_RUNTIME_DEPSis not specified, butTERMUX_PKG_PYTHON_TARGET_DEPSis, thenTERMUX_PKG_PYTHON_TARGET_DEPSwill be used as both on-device build and on-device runtime dependencies,TERMUX_PKG_PYTHON_RUNTIME_DEPSis specified, thenTERMUX_PKG_PYTHON_TARGET_DEPS, if specified, is used only for on-device build-time dependencies.python-pipis also automatically inserted into the runtime dependencies of every package that needs it, appropriately.