aboutsummaryrefslogtreecommitdiffstats
path: root/main/py-docutils
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2016-11-19 15:36:03 +0100
committerJakub Jirutka <jakub@jirutka.cz>2016-11-19 15:36:50 +0100
commitf830ff756aaedda68fdebecac2aecd3ed6531c18 (patch)
treef887dcc0df15663e0c25f365c349ce8b905b9ef8 /main/py-docutils
parent4d1bfb6677837a7ab97a1d82194eba821145e73f (diff)
downloadaports-f830ff756aaedda68fdebecac2aecd3ed6531c18.tar.bz2
aports-f830ff756aaedda68fdebecac2aecd3ed6531c18.tar.xz
main/py-docutils: fix conflict between /usr/bin from py2 and py3
Diffstat (limited to 'main/py-docutils')
-rw-r--r--main/py-docutils/APKBUILD27
1 files changed, 23 insertions, 4 deletions
diff --git a/main/py-docutils/APKBUILD b/main/py-docutils/APKBUILD
index d2519a09ba..d1dd4645ef 100644
--- a/main/py-docutils/APKBUILD
+++ b/main/py-docutils/APKBUILD
@@ -8,9 +8,9 @@ pkgdesc="Documentation Utilities for Python"
url="http://docutils.sourceforge.net/"
arch="noarch"
license="Public Domain"
-depends="py-pillow py-roman"
+depends="py3-${pkgname#py-}"
makedepends="python2-dev python3-dev py-setuptools"
-subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3 $pkgname-doc"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3 $pkgname-doc::noarch"
source="http://downloads.sourceforge.net/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
@@ -22,16 +22,25 @@ build() {
package() {
mkdir -p "$pkgdir"
+
+ local py3ver="$(_pyver python3)"
+
+ # Create unsuffixed symlinks for executables from py3 subpackage.
+ cd "$builddir"/tools
+ mkdir -p "$pkgdir"/usr/bin
+ local name; for name in rst*.py; do
+ ln -s ${name%.py}-$py3ver "$pkgdir"/usr/bin/${name%.py}
+ done
}
_py2() {
replaces="$pkgname"
- depends="${depends//py-/py2-}"
+ depends="py2-pillow py2-roman"
_py python2
}
_py3() {
- depends="${depends//py-/py3-}"
+ depends="py3-pillow py3-roman"
_py python3
}
@@ -43,6 +52,12 @@ _py() {
cd "$builddir"
$python setup.py install --prefix=/usr --root="$subpkgdir"
+
+ # Remove .py extension and add version suffix to executable files.
+ local pyver="$(_pyver $python)"
+ local path; for path in "$subpkgdir"/usr/bin/*.py; do
+ mv "$path" "${path/.py/-$pyver}" || return 1
+ done
}
doc() {
@@ -61,6 +76,10 @@ doc() {
cp licenses/* "$licdir"/
}
+_pyver() {
+ "$1" -V 2>&1 | sed -En 's/[Pp]ython (\d+\.\d+).*/\1/p'
+}
+
md5sums="4622263b62c5c771c03502afa3157768 docutils-0.12.tar.gz"
sha256sums="c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa docutils-0.12.tar.gz"
sha512sums="0087433f8b76e1d0302d2fab77fdbda941132d16ac1fcecb26ca66119687eefd9e2f6901e05d705f857fa31e2526136c9827dfd57c44cd295bd10dcce3faebf9 docutils-0.12.tar.gz"