diff options
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | PKGBUILD | 68 | ||||
-rw-r--r-- | wordcloud.patch | 13 |
3 files changed, 105 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..da42dc7d05c1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = python2-word-cloud-git + pkgdesc = A little word cloud generator in Python 2 + pkgver = 1.1.0.r117.6ebeab0 + pkgrel = 2 + url = https://github.com/amueller/word_cloud + arch = i686 + arch = x86_64 + license = MIT + makedepends = git + makedepends = python2-setuptools + depends = python2 + depends = cython2 + depends = python2-pillow + depends = python2-numpy + depends = ttf-droid + provides = python2-word_cloud + conflicts = python2-word_cloud + source = git+https://github.com/amueller/word_cloud.git + source = wordcloud.patch + sha256sums = SKIP + sha256sums = 0d3379d5a8c4481c2a3deaa8ab809c1817fa9a5e6178f7a55773ef45f46c8f10 + +pkgname = python2-word-cloud-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..db95d8361cab --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,68 @@ +# Maintainer: jyantis <yantis@yantis.net> + +pkgname=python2-word-cloud-git +pkgver=1.1.0.r117.6ebeab0 +pkgrel=2 +pkgdesc='A little word cloud generator in Python 2' +arch=('any') +arch=('i686' 'x86_64') +url='https://github.com/amueller/word_cloud' +license=('MIT') +depends=('python2' 'cython2' 'python2-pillow' 'python2-numpy' 'ttf-droid') +source=('git+https://github.com/amueller/word_cloud.git' 'wordcloud.patch') +sha256sums=('SKIP' '0d3379d5a8c4481c2a3deaa8ab809c1817fa9a5e6178f7a55773ef45f46c8f10') +makedepends=('git' 'python2-setuptools') +provides=('python2-word_cloud') +conflicts=('python2-word_cloud') + +pkgver() { + cd word_cloud + set -o pipefail + _gitversion=$( git describe --long | sed -r 's/([^-]*-g)/r\1/;s/-/./g' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" ) + + # If there is a setup.py then pull the version tag from the file + if [ -f "setup.py" ]; then + if grep --quiet "version = " setup.py; then + printf "%s.%s" "$(grep -R "version = " setup.py | awk -F\' '{print $2}')" $_gitversion | sed 's/-/./g' + elif grep --quiet "version=" setup.py; then + printf "%s.%s" "$(grep -R "version=" setup.py | awk -F\' '{print $2}')" $_gitversion | sed 's/-/./g' + else + printf "%s" $_gitversion + fi + else + printf "%s" $_gitversion + fi +} + +build() { + # patch to fix font patch for Arch Linux + #patch word_cloud/wordcloud/wordcloud.py < wordcloud.patch + + cd word_cloud + + # Patch any #!/usr/bin/python to #!/usr/bin/python2 + for file in $(find . -name '*.py' -print); do + sed -r -i 's_^#!.*/usr/bin/python(\s|$)_#!/usr/bin/python2_' $file + sed -r -i 's_^#!.*/usr/bin/env(\s)*python(\s|$)_#!/usr/bin/env python2_' $file + done + + python2 setup.py build +} + +package() { + cd word_cloud + + # We don't need anything related to git in the package + rm -rf .git* + + python2 setup.py install --root="${pkgdir}" --optimize=1 + + # Install License + install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + + # Install Documentation + install -D -m644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md" +} + +# vim:set ts=2 sw=2 et: diff --git a/wordcloud.patch b/wordcloud.patch new file mode 100644 index 000000000000..81b647a7afdf --- /dev/null +++ b/wordcloud.patch @@ -0,0 +1,13 @@ +--- wordcloud.original 2015-01-08 08:04:20.760754809 -0800 ++++ wordcloud.modified 2015-01-08 08:14:58.750537478 -0800 +@@ -18,7 +18,9 @@ + + item1 = itemgetter(1) + +-FONT_PATH = os.environ.get("FONT_PATH", "/usr/share/fonts/truetype/droid/DroidSansMono.ttf") ++# Patch to work on Arch Linux ++FONT_PATH = "/usr/share/fonts/TTF/DroidSansMono.ttf" ++# FONT_PATH = os.environ.get("FONT_PATH", "/usr/share/fonts/truetype/droid/DroidSansMono.ttf") + STOPWORDS = set([x.strip() for x in open(os.path.join(os.path.dirname(__file__), + 'stopwords')).read().split('\n')]) + |