git » python-keyring.git » commit 5703496

make this a split package and also provide python2-keyring

author Filipe Laíns
2018-08-20 22:13:57 UTC
committer Filipe Laíns
2018-08-20 22:13:57 UTC
parent 2979a6c1cb59090a3ad4b056a229dd591ee82f49

make this a split package and also provide python2-keyring

PKGBUILD +38 -14

diff --git a/PKGBUILD b/PKGBUILD
index ae277f3..fef8a75 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,43 +1,67 @@
 # Maintainer: Felix Yan <felixonmars@archlinux.org>
+# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
 # Contributor: Johannes Dewender  arch at JonnyJD dot net
 # Contributor: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>
 # Contributor: Brice Maron <brice@bmaron.net>
 # Contributor: Nuno Araujo <nuno.araujo at russo79.com>
 # Contributor: Steven Allen <steven {at} stebalien {dot} com>
 
-pkgname=python-keyring
+pkgbase=python-keyring
+_pkgname=${pkgbase#python-}
+pkgname=(python-$_pkgname python2-$_pkgname)
 pkgver=13.2.1
-pkgrel=2
+pkgrel=3
 pkgdesc="Store and access your passwords safely."
 arch=('any')
 url="https://pypi.org/project/keyring/"
 license=('PSF' 'MIT')
-depends=('python-entrypoints' 'python-secretstorage')
 optdepends=('python-keyrings-alt: Alternative backends')
-makedepends=('python-setuptools-scm')
-checkdepends=('python-pytest-flake8' 'python-pytest-runner')
-source=("https://pypi.io/packages/source/k/keyring/keyring-$pkgver.tar.gz")
+makedepends=('python-setuptools-scm' 'python2-setuptools-scm')
+checkdepends=('python-pytest-flake8' 'python-pytest-runner' 'python2-pytest-flake8' 'python2-pytest-runner')
+source=("https://pypi.io/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
 sha512sums=('3c15c3415ba4b657b041d2395536fc92ba656dc71f28669235f13a630946ad1b332d1f5b031a55776ce8a2120d3d2601462708f00ee105f46a27cf043c1bd906')
 
 prepare() {
-  cd keyring-$pkgver
-  echo -e '\nflake8-ignore = W191 W503 W504' >> pytest.ini
+  echo -e '\nflake8-ignore = W191 W503 W504' >> $_pkgname-$pkgver/pytest.ini
+
+  cp -a $_pkgname-$pkgver{,-py2}
 }
 
 build() {
-  cd keyring-$pkgver
+  echo "Building python-$_pkgname $pkgver"
+  cd "$srcdir"/$_pkgname-$pkgver
   python setup.py build
+
+  echo "Building python2-$_pkgname $pkgver"
+  cd "$srcdir"/$_pkgname-$pkgver-py2
+  python2 setup.py build
 }
 
 check() {
-  cd keyring-$pkgver
+  echo "Running tests on python-$_pkgname $pkgver"
+  cd "$srcdir"/$_pkgname-$pkgver
   python setup.py pytest
+
+  echo "Running tests on python2-$_pkgname $pkgver"
+  cd "$srcdir"/$_pkgname-$pkgver-py2
+  python2 setup.py pytest
 }
 
-package() {
-  cd keyring-$pkgver
-  python setup.py install --root="$pkgdir" --optimize=1
-  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+package_python-keyring() {
+  depends=('python-entrypoints' 'python-secretstorage')
+  cd $_pkgname-$pkgver
+
+  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}
+
+package_python2-keyring() {
+  depends=('python2-entrypoints' 'python2-secretstorage')
+  cd $_pkgname-$pkgver-py2
+
+  python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
+  mv "$pkgdir"/usr/bin/keyring "$pkgdir"/usr/bin/keyring2 # Fix the binary name
+  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
 }
 
 # vim:set ts=2 sw=2 et: