python-rdflib: use alternatives

This commit is contained in:
Alessio Sergi 2016-05-01 01:47:54 +02:00
parent 28c1e132a3
commit 2ca449a39a

View file

@ -1,9 +1,10 @@
# Template file for 'python-rdflib'
pkgname=python-rdflib
version=4.2.1
revision=1
revision=2
noarch=yes
wrksrc="rdflib-${version}"
build_style=python-module
python_versions="2.7 3.4"
hostmakedepends="python-setuptools python3.4-setuptools"
depends="python-setuptools python-isodate python-parsing"
@ -11,42 +12,36 @@ pycompile_module="rdflib"
short_desc="Python2 library for working with RDF"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://github.com/RDFLib/rdflib"
license="BSD"
license="3-clause-BSD"
distfiles="${PYPI_SITE}/r/rdflib/rdflib-${version}.tar.gz"
checksum=eb02bd235606ef3b26e213da3e576557a6392ce103efd8c6c8ff1e08321608c8
pre_build() {
cp -a ${wrksrc} /tmp/rdflib-2.7
cp -a ${wrksrc} /tmp/rdflib-3.4
mv /tmp/rdflib-{2.7,3.4} ${wrksrc}
alternatives="
rdflib:csv2rdf:/usr/bin/csv2rdf2.7
rdflib:rdf2dot:/usr/bin/rdf2dot2.7
rdflib:rdfgraphisomorphism:/usr/bin/rdfgraphisomorphism2.7
rdflib:rdfpipe:/usr/bin/rdfpipe2.7
rdflib:rdfs2dot:/usr/bin/rdfs2dot2.7"
cd ${wrksrc}/rdflib-3.4
for f in csv2rdf rdf{2dot,graphisomorphism,pipe,s2dot}; do
sed -i "s,\(${f}\) =,\13 =," setup.py
done
find . -type f -name '*.py' -exec sed -i 's,#!/usr/bin/env python,&3.4,' {} +
}
do_build() {
for pyver in $python_versions; do
cd ${wrksrc}/rdflib-${pyver}
python${pyver} setup.py build
done
}
do_install() {
for pyver in $python_versions; do
cd ${wrksrc}/rdflib-${pyver}
python${pyver} setup.py install --root=${DESTDIR}
done
post_install() {
vlicense LICENSE
}
python3.4-rdflib_package() {
alternatives="
rdflib:csv2rdf:/usr/bin/csv2rdf3.4
rdflib:rdf2dot:/usr/bin/rdf2dot3.4
rdflib:rdfgraphisomorphism:/usr/bin/rdfgraphisomorphism3.4
rdflib:rdfpipe:/usr/bin/rdfpipe3.4
rdflib:rdfs2dot:/usr/bin/rdfs2dot3.4"
noarch=yes
depends="python3.4-setuptools python3.4-isodate python3.4-parsing"
pycompile_version="3.4"
pycompile_module="rdflib"
short_desc="${short_desc/Python2/Python3.4}"
pkg_install() {
vmove usr/bin/*3
vmove usr/bin/*3.4
vmove usr/lib/python3.4
vlicense LICENSE
}
}