summaryrefslogtreecommitdiffstats
path: root/python/python3-pykeepass
diff options
context:
space:
mode:
Diffstat (limited to 'python/python3-pykeepass')
-rw-r--r--python/python3-pykeepass/README2
-rw-r--r--python/python3-pykeepass/fix_missing_pykeepass_kdbx_parsing.patch13
-rw-r--r--python/python3-pykeepass/python3-pykeepass.SlackBuild95
-rw-r--r--python/python3-pykeepass/python3-pykeepass.info10
-rw-r--r--python/python3-pykeepass/slack-desc19
-rw-r--r--python/python3-pykeepass/use_built_in_isoformat_support.patch33
6 files changed, 172 insertions, 0 deletions
diff --git a/python/python3-pykeepass/README b/python/python3-pykeepass/README
new file mode 100644
index 0000000000..fade733ad2
--- /dev/null
+++ b/python/python3-pykeepass/README
@@ -0,0 +1,2 @@
+The pykeepass library allows users to write entries to a KeePass
+database.
diff --git a/python/python3-pykeepass/fix_missing_pykeepass_kdbx_parsing.patch b/python/python3-pykeepass/fix_missing_pykeepass_kdbx_parsing.patch
new file mode 100644
index 0000000000..0f75cec6b2
--- /dev/null
+++ b/python/python3-pykeepass/fix_missing_pykeepass_kdbx_parsing.patch
@@ -0,0 +1,13 @@
+This patch was taken from Arch Linux's gitlab repo:
+https://gitlab.archlinux.org/archlinux/packaging/packages/python-pykeepass/-/blob/main/0001-fix_missing_pykeepass_kdbx_parsing.patch
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -37,7 +37,7 @@
+ Changelog = "https://github.com/libkeepass/pykeepass/blob/master/CHANGELOG.rst"
+
+ [tool.setuptools]
+-packages = ["pykeepass"]
++packages = ["pykeepass", "pykeepass.kdbx_parsing"]
+ include-package-data = true
+
+ [build-system]
diff --git a/python/python3-pykeepass/python3-pykeepass.SlackBuild b/python/python3-pykeepass/python3-pykeepass.SlackBuild
new file mode 100644
index 0000000000..4f23b98d47
--- /dev/null
+++ b/python/python3-pykeepass/python3-pykeepass.SlackBuild
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+# Slackware build script for python3-pykeepass
+
+# Copyright 2024 Isaac Yu <isaacyu@protonmail.com>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=python3-pykeepass
+VERSION=${VERSION:-4.0.7}
+BUILD=${BUILD:-3}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+SRCNAM=pykeepass
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SRCNAM-$VERSION
+tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
+cd $SRCNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# fix dos line endings or patch will fail
+perl -pi -e 's/\r\n/\n/g' pyproject.toml
+
+# Fix missing pykeepass.kdbx_parsing when built with modern tools
+# https://github.com/libkeepass/pykeepass/pull/378
+patch -p1 < $CWD/fix_missing_pykeepass_kdbx_parsing.patch
+
+# Use built-in isoformat support
+# https://github.com/libkeepass/pykeepass/pull/383
+patch -p1 < $CWD/use_built_in_isoformat_support.patch
+
+PYVER=$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')
+export PYTHONPATH=/opt/python$PYVER/site-packages/
+
+python3 -m build --no-isolation
+python3 -m installer -d "$PKG" dist/*.whl
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a CHANGELOG.rst LICENSE README.rst $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/python/python3-pykeepass/python3-pykeepass.info b/python/python3-pykeepass/python3-pykeepass.info
new file mode 100644
index 0000000000..e0841b442b
--- /dev/null
+++ b/python/python3-pykeepass/python3-pykeepass.info
@@ -0,0 +1,10 @@
+PRGNAM="python3-pykeepass"
+VERSION="4.0.7"
+HOMEPAGE="https://github.com/libkeepass/pykeepass"
+DOWNLOAD="https://github.com/libkeepass/pykeepass/archive/v4.0.7/pykeepass-4.0.7.tar.gz"
+MD5SUM="5f5aa9ac74ada7779385d65dc375279e"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="python3-argon2-cffi python3-construct python3-lxml python3-setuptools-opt pycryptodomex"
+MAINTAINER="Isaac Yu"
+EMAIL="isaacyu@protonmail.com"
diff --git a/python/python3-pykeepass/slack-desc b/python/python3-pykeepass/slack-desc
new file mode 100644
index 0000000000..e6fcc4b78a
--- /dev/null
+++ b/python/python3-pykeepass/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+python3-pykeepass: python3-pykeepass (Python library to interact with KeePass databases)
+python3-pykeepass:
+python3-pykeepass: The pykeepass library allows users to write entries to a KeePass
+python3-pykeepass: database.
+python3-pykeepass:
+python3-pykeepass:
+python3-pykeepass:
+python3-pykeepass:
+python3-pykeepass:
+python3-pykeepass:
+python3-pykeepass:
diff --git a/python/python3-pykeepass/use_built_in_isoformat_support.patch b/python/python3-pykeepass/use_built_in_isoformat_support.patch
new file mode 100644
index 0000000000..4daf98514b
--- /dev/null
+++ b/python/python3-pykeepass/use_built_in_isoformat_support.patch
@@ -0,0 +1,33 @@
+This patch was taken from Arch Linux's gitlab repo:
+https://gitlab.archlinux.org/archlinux/packaging/packages/python-pykeepass/-/blob/main/0002-Use_built_in_isoformat_support.patch
+--- a/pykeepass/pykeepass.py
++++ b/pykeepass/pykeepass.py
+@@ -28,7 +28,6 @@
+ BLANK_DATABASE_FILENAME = "blank_database.kdbx"
+ BLANK_DATABASE_LOCATION = os.path.join(os.path.dirname(os.path.realpath(__file__)), BLANK_DATABASE_FILENAME)
+ BLANK_DATABASE_PASSWORD = "password"
+-DT_ISOFORMAT = "%Y-%m-%dT%H:%M:%S%fZ"
+
+ class PyKeePass():
+ """Open a KeePass database
+@@ -804,7 +803,7 @@ def _encode_time(self, value):
+ struct.pack('<Q', diff_seconds)
+ ).decode('utf-8')
+ else:
+- return value.strftime(DT_ISOFORMAT)
++ return value.isoformat()
+
+ def _decode_time(self, text):
+ """datetime.datetime: Convert base64 time or plaintext time to datetime"""
+@@ -819,9 +818,9 @@ def _decode_time(self, text):
+ )
+ )
+ except BinasciiError:
+- return datetime.strptime(text, DT_ISOFORMAT).replace(tzinfo=timezone.utc)
++ return datetime.fromisoformat(text).replace(tzinfo=timezone.utc)
+ else:
+- return datetime.strptime(text, DT_ISOFORMAT).replace(tzinfo=timezone.utc)
++ return datetime.fromisoformat(text).replace(tzinfo=timezone.utc)
+
+ def create_database(
+ filename, password=None, keyfile=None, transformed_key=None