Skip to content

Instantly share code, notes, and snippets.

@FFY00
Created August 20, 2018 17:24
Show Gist options
  • Save FFY00/20ae3748a910484864c98647aa4cb20c to your computer and use it in GitHub Desktop.
Save FFY00/20ae3748a910484864c98647aa4cb20c to your computer and use it in GitHub Desktop.
Datrie PKGBUILD
# Maintainer: Clint Valentine <[email protected]>
# Contributor: Filipe Laíns (FFY00) <[email protected]>
pkgbase=python-datrie
_pkgname=${pkgbase#python-}
pkgname=(python-$_pkgname python2-$_pkgname)
pkgver=0.7.1
pkgrel=2
pkgdesc="Super-fast, efficiently stored Trie for Python"
arch=('x86_64')
url="https://github.com/pytries/datrie"
license=('LGPL')
makedepends=('python-setuptools' 'python2-setuptools' 'cython')
checkdepends=('python-pytest-runner' 'python2-pytest-runner' 'python-hypothesis' 'python2-hypothesis')
options=(!emptydirs)
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
sha512sums=('dd81fa726b601a5c38b7c838111996852c2c3fae3ddab90f00ac37c62bb7dbcd3fa55aa7e57007b157daddc8d597f4298424503233b50dadbcb484916b961e07')
prepare() {
rm -rf $_pkgname-$pkgver-py2 # Tests fail if we keep the cache
cp -a $_pkgname-$pkgver{,-py2}
}
build() {
msg2 "Building python-$_pkgname $pkgver"
cd "$srcdir"/$_pkgname-$pkgver
./update_c.sh
python setup.py build
msg2 "Building python2-$_pkgname $pkgver"
cd "$srcdir"/$_pkgname-$pkgver-py2
./update_c.sh
python2 setup.py build
}
check() {
msg2 "Running tests on python-$_pkgname $pkgver"
cd "$srcdir"/$_pkgname-$pkgver
python setup.py pytest
msg2 "Running tests on python2-$_pkgname $pkgver"
cd "$srcdir"/$_pkgname-$pkgver-py2
python2 setup.py pytest
}
package_python-datrie() {
depends=('python')
cd $_pkgname-$pkgver
python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}
package_python2-datrie() {
depends=('python2')
cd $_pkgname-$pkgver-py2
python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
}
@FFY00
Copy link
Author

FFY00 commented Aug 20, 2018

Changelog:

  • fixed build
  • fixed license
  • fixed arch (the package generates .so files so it should be x86_64, not any)
  • added tests
  • changed the url (github page is more suitable than pypi)
  • cleaned up the style (more readable now)
  • changed checksum to sha512

@clintval
Copy link

Thanks @FFY00, I merged many of your changes in! Thanks for helping :D

I changed back to using PyPi as the source since that is all the wiki mentions and is the same package that pip pulls from:

https://wiki.archlinux.org/index.php/Python_package_guidelines#Source

@FFY00
Copy link
Author

FFY00 commented Aug 20, 2018

@clintval, just a heads up. I moved this package to the [community] repo as it was needed as a dependency of Tribler. I didn't think that tribler package would be ready so soon, that's why I contacted you with the patch. There's really no difference in the source of the tarball (well, at least when we're talking about github vs pypi), I usually pull from github because most of the times the url is already present in the PKGBUILD. Also, pip pulls the .whl file, not the tarball, so it really makes no difference 😄.

If you need anything, feel free to contact me 😊.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment