Skip to content

Commit

Permalink
Update version, patches and build script
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Brox committed Oct 8, 2022
1 parent f5c8c3d commit 4456625
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 160 deletions.
51 changes: 8 additions & 43 deletions packages/nala/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://gitlab.com/volian/nala
TERMUX_PKG_DESCRIPTION="Commandline frontend for the apt package manager"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.7.2
TERMUX_PKG_VERSION=0.11.1
TERMUX_PKG_SRCURL=https://gitlab.com/volian/nala/-/archive/v${TERMUX_PKG_VERSION}/nala-v${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=0ac394ab2bd924c28c513a8e8bfc9e899a21f2f8fa5e5d77366cb20e0be8676e
TERMUX_PKG_SHA256=4ce87d75e785e45b1638817077797a3fcd4a15059615455fc1af0127c70cf5cd
TERMUX_PKG_DEPENDS="python-apt"
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
Expand All @@ -17,57 +17,22 @@ lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
lib/python${_PYTHON_VERSION}/site-packages/site.py
"

termux_step_post_get_source() {
sed 's:@TERMUX_PKG_VERSION@:'${TERMUX_PKG_VERSION##*:}':g' \
${TERMUX_PKG_BUILDER_DIR}/pyproject.toml.diff | \
patch --silent -p1
}

termux_step_pre_configure() {
termux_setup_python_crossenv
pushd $TERMUX_PYTHON_CROSSENV_SRCDIR
_CROSSENV_PREFIX=$TERMUX_PKG_BUILDDIR/python-crossenv-prefix
python${_PYTHON_VERSION} -m crossenv \
$TERMUX_PREFIX/bin/python${_PYTHON_VERSION} \
${_CROSSENV_PREFIX}
popd
. ${_CROSSENV_PREFIX}/bin/activate

build-pip install tomli
}

termux_step_make_install() {
python setup.py install --force

export PYTHONPATH=$TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages
python setup.py install --force --prefix $TERMUX_PREFIX

pushd $PYTHONPATH
_NALA_EGG=
for f in nala-${TERMUX_PKG_VERSION##*:}-py${_PYTHON_VERSION}.egg; do
if [ -e "$f" ]; then
_NALA_EGG="$f"
break
fi
done
test -n "${_NALA_EGG}"
popd
# Activate venv to trick python into installing in the correct location
python -m venv $TERMUX_PKG_BUILDDIR/python-venv
source $TERMUX_PKG_BUILDDIR/python-venv/bin/activate

python${_PYTHON_VERSION} -m pip install . --no-deps --prefix $TERMUX_PREFIX
install -Dm600 -t $TERMUX_PREFIX/etc/nala debian/nala.conf
}

termux_step_create_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
echo "./${_NALA_EGG}" >> $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
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 anyio httpx jsbeautifier pexpect rich
EOF

cat <<- EOF > ./prerm
#!$TERMUX_PREFIX/bin/sh
sed -i "/\.\/${_NALA_EGG//./\\.}/d" $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
pip3 install anyio httpx jsbeautifier pexpect rich tomli python-debian
EOF
}
18 changes: 11 additions & 7 deletions packages/nala/nala-__init__.py.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
--- a/nala/__init__.py
+++ b/nala/__init__.py
@@ -29,7 +29,7 @@
@@ -30,9 +30,9 @@
# ROOT = "@TERMUX_PREFIX@"
# USR = "@TERMUX_PREFIX@"
# TERMUX = True
-ROOT = ""
-USR = "/usr"
-TERMUX = False
+ROOT = "@TERMUX_PREFIX@"
+USR = "@TERMUX_PREFIX@"
+TERMUX = True

# Before we import anything else we need to make sure that this is in our path
# Else apt_pkg will give an import error. Conda is an example of this breaking
# pylint: disable=wrong-import-position
-PY_PATH = "/usr/lib/python3/dist-packages"
+PY_PATH = "@TERMUX_PREFIX@/lib/python3/dist-packages"
if PY_PATH not in sys.path:
sys.path.append(PY_PATH)

11 changes: 0 additions & 11 deletions packages/nala/nala-config.py.patch

This file was deleted.

44 changes: 0 additions & 44 deletions packages/nala/nala-constants.py.patch

This file was deleted.

11 changes: 0 additions & 11 deletions packages/nala/nala-error.py.patch

This file was deleted.

11 changes: 0 additions & 11 deletions packages/nala/nala-utils.py.patch

This file was deleted.

10 changes: 0 additions & 10 deletions packages/nala/pyproject.toml.diff

This file was deleted.

23 changes: 0 additions & 23 deletions packages/nala/setup.py.patch

This file was deleted.

0 comments on commit 4456625

Please sign in to comment.