Skip to content

Commit

Permalink
new pkgs:
Browse files Browse the repository at this point in the history
gpkg/python
gpkg/python-pip
gpkg/python-xcbgen
  • Loading branch information
Maxython committed Nov 2, 2023
1 parent 7be3731 commit 9aea19c
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 4 deletions.
53 changes: 53 additions & 0 deletions gpkg/python-pip/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
TERMUX_PKG_HOMEPAGE=https://pip.pypa.io/
TERMUX_PKG_DESCRIPTION="The PyPA recommended tool for installing Python packages"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION="23.3.1"
TERMUX_PKG_SRCURL=https://github.com/pypa/pip/archive/$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=4192f1ed5f8f1e01557d8c02ffd845c64d4a4567e0864ca78b74b0b5456c0f62
TERMUX_PKG_DEPENDS="gcc-glibc, make-glibc, pkgconf-glibc, python-glibc (>= 3.11.1-1)"
TERMUX_PKG_ANTI_BUILD_DEPENDS="gcc-glibc"
TERMUX_PKG_BREAKS="python-glibc (<< 3.11.1-1)"
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, docutils, myst_parser, sphinx_copybutton, sphinx_inline_tabs, sphinxcontrib.towncrier, completion"

termux_step_post_make_install() {
( # creating pip documentation
cd docs/
python pip_sphinxext.py
sphinx-build -b man -d build/doctrees/man man build/man -c html
)

install -vDm 644 LICENSE.txt -t "$TERMUX_PREFIX/share/licenses/python-pip/"
install -vDm 644 docs/build/man/*.1 -t "$TERMUX_PREFIX/share/man/man1/"
install -vDm 644 {NEWS,README}.rst -t "$TERMUX_PREFIX/share/doc/python-pip/"

"$TERMUX_PREFIX"/bin/pip completion --bash | install -vDm 644 /dev/stdin "$TERMUX_PREFIX"/share/bash-completion/completions/pip
"$TERMUX_PREFIX"/bin/pip completion --fish | install -vDm 644 /dev/stdin "$TERMUX_PREFIX"/share/fish/vendor_completions.d/pip.fish
}

termux_step_create_debscripts() {
# disable pip update notification
cat <<- POSTINST_EOF > ./postinst
#!$TERMUX_PREFIX/bin/bash
echo "pip setup..."
pip config set --global global.disable-pip-version-check true
exit 0
POSTINST_EOF
if [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ]; then
echo "post_install" > postupg
fi

# deleting conf of pip while removing it
cat <<- PRERM_EOF > ./prerm
#!$TERMUX_PREFIX/bin/bash
if [ -d $TERMUX_PREFIX/etc/pip.conf ]; then
echo "Removing the pip setting..."
rm -fr $TERMUX_PREFIX/etc/pip.conf
fi
exit 0
PRERM_EOF

chmod 0755 postinst prerm
}
14 changes: 14 additions & 0 deletions gpkg/python-pip/conf.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- pip-22.3.1/docs/html/conf.py 2022-11-05 18:25:43.000000000 +0300
+++ pip-22.3.1/docs/html/conf.py.patch 2022-12-01 18:27:35.429357992 +0300
@@ -21,11 +21,6 @@
"sphinx.ext.intersphinx",
# our extensions
"pip_sphinxext",
- # third-party extensions
- "myst_parser",
- "sphinx_copybutton",
- "sphinx_inline_tabs",
- "sphinxcontrib.towncrier",
]

# General information about the project.
19 changes: 19 additions & 0 deletions gpkg/python-pip/fix-hardcoded-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- pip-22.3.1/src/pip/_internal/utils/appdirs.py
+++ pip-22.3.1/src/pip/_internal/utils/appdirs.py
@@ -49,4 +49,4 @@ def site_config_dirs(appname: str) -> List[str]:
return [dirval]

# Unix-y system. Look in /etc as well.
- return dirval.split(os.pathsep) + ["/etc"]
+ return dirval.split(os.pathsep) + ["@TERMUX_PREFIX@/etc"]
--- pip-22.3.1/src/pip/_vendor/platformdirs/unix.py
+++ pip-22.3.1/src/pip/_vendor/platformdirs/unix.py
@@ -79,7 +79,7 @@ def site_config_dir(self) -> str:
# XDG default for $XDG_CONFIG_DIRS only first, if multipath is False
path = os.environ.get("XDG_CONFIG_DIRS", "")
if not path.strip():
- path = "/etc/xdg"
+ path = "@TERMUX_PREFIX@/etc/xdg"
return self._with_multi_path(path)

@property
23 changes: 23 additions & 0 deletions gpkg/python-pip/install_py_preventing_pip_from_installing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- pip-23.1/src/pip/_internal/commands/install.py 2023-04-16 00:05:42.665257200 +0100
+++ pip-23.1.mod/src/pip/_internal/commands/install.py 2023-04-16 00:09:42.989257317 +0100
@@ -342,6 +342,20 @@
reqs = self.get_requirements(args, options, finder, session)
check_legacy_setup_py_options(options, reqs)

+ reqs_list = [req.name for req in reqs]
+ while reqs_list.count("pip") != 0:
+ reqs_index = reqs_list.index("pip")
+ if len(reqs)-reqs_list.count("pip") == 0:
+ raise CommandError(
+ "Installing pip is forbidden, this will break the python-pip package (termux)."
+ )
+ elif reqs_list.count("pip") == 1:
+ logger.warning(
+ "Skip installing pip, this will break the python-pip package (termux)."
+ )
+ del reqs_list[reqs_index]
+ del reqs[reqs_index]
+
wheel_cache = WheelCache(options.cache_dir)

# Only when installing is it permitted to use PEP 660.
9 changes: 5 additions & 4 deletions gpkg-disabled/python/build.sh → gpkg/python/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ TERMUX_PKG_DESCRIPTION="The Python programming language"
TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_LICENSE_FILE="LICENSE"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=3.11.5
TERMUX_PKG_VERSION=3.11.6
_MAJOR_VERSION="${TERMUX_PKG_VERSION%.*}"
TERMUX_PKG_SRCURL=https://www.python.org/ftp/python/${TERMUX_PKG_VERSION%rc*}/Python-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=85cd12e9cf1d6d5a45f17f7afe1cebe7ee628d3282281c492e86adf636defa3f
TERMUX_PKG_SHA256=0fab78fa7f133f4f38210c6260d90d7c0d5c7198446419ce057ec7ac2e6f5f38
TERMUX_PKG_DEPENDS="libbz2-glibc, libexpat-glibc, gdbm-glibc, libffi-glibc, libnsl-glibc, libxcrypt-glibc, openssl-glibc, zlib-glibc"
TERMUX_PKG_BUILD_DEPENDS="sqlite-glibc, mpdecimal-glibc"
TERMUX_PKG_BUILD_DEPENDS="sqlite-glibc, mpdecimal-glibc, llvm-glibc"
TERMUX_PKG_PROVIDES="python3-glibc"
TERMUX_PKG_BUILD_IN_SRC=true

Expand All @@ -34,7 +34,8 @@ termux_step_configure() {
--with-dbmliborder=gdbm:ndbm \
--enable-loadable-sqlite-extensions \
--without-ensurepip \
LN='ln -s'
LN='ln -s' \
MULTIARCH=${TERMUX_HOST_PLATFORM}
}

termux_step_make_install() {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 9aea19c

Please sign in to comment.