add a python3-subpackage (rhbz#1086844)

epel9
Matthias Runge 10 years ago
parent b5f6110b46
commit 25a74e4344

@ -1,8 +1,19 @@
%define run_tests 1
%if 0%{?fedora} > 12
%global with_python3 1
%endif
%{!?__python2:%global __python2 %{__python}}
%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
%{!?python2_version: %global python2_version %{python_version}}
%global pypi_name rdflib
%global run_tests 1
Name: python-rdflib
Version: 4.1.2
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Python library for working with RDF
Group: Development/Languages
@ -12,7 +23,6 @@ Source0: http://pypi.python.org/packages/source/r/rdflib/rdflib-%{version
Patch1: python-rdflib-SPARQLWrapper-optional.patch
BuildArch: noarch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires: python-html5lib >= 1:
Requires: python-isodate
Requires: pyparsing
@ -20,8 +30,8 @@ Requires: pyparsing
BuildRequires: python-html5lib >= 1:
BuildRequires: python-isodate
BuildRequires: pyparsing
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if %{run_tests}
BuildRequires: python-nose >= 0.9.2
@ -29,6 +39,7 @@ BuildRequires: python-nose >= 0.9.2
Obsoletes: python-rdfextras <= 0.1-7
%description
RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information.
@ -42,20 +53,75 @@ of the Berkeley DB, and a wrapper for remote SPARQL endpoints.
A SPARQL 1.1 engine is also included.
%if %{with_python3}
%package -n python3-%{pypi_name}
Summary: Python library for working with RDF
BuildRequires: python3-html5lib >= 1:
BuildRequires: python3-isodate
BuildRequires: python3-pyparsing
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if %{run_tests}
BuildRequires: python3-nose >= 0.9.2
%endif
%description -n python3-%{pypi_name}
RDFLib is a Python library for working with RDF, a simple yet powerful
language for representing information.
The library contains parsers and serializers for RDF/XML, N3,
NTriples, Turtle, TriX, RDFa and Microdata. The library presents
a Graph interface which can be backed by any one of a number of
Store implementations. The core rdflib includes store
implementations for in memory storage, persistent storage on top
of the Berkeley DB, and a wrapper for remote SPARQL endpoints.
A SPARQL 1.1 engine is also included.
%endif
%prep
%setup -q -n rdflib-%{version}
%patch1 -p1
# remove bundled egg-info
rm -rf %{pypi_name}.egg-info
find -name "*.pyc" -delete
sed -i -e 's|_sn_gen=bnode_uuid()|_sn_gen=bnode_uuid|' test/test_bnode_ncname.py
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%{__python2} setup.py build
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
popd
# rename binaries
for i in csv2rdf rdf2dot rdfgraphisomorphism rdfpipe rdfs2dot; do
mv %{buildroot}%{_bindir}/$i %{buildroot}%{_bindir}/python3-$i
done
%endif
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
cp LICENSE $RPM_BUILD_ROOT/%{python_sitelib}/rdflib/LICENSE
# Various .py files within site-packages have a shebang line but aren't
@ -93,12 +159,31 @@ PYTHONPATH=./build/lib %{__python} run_tests.py --verbose
%endif
%files
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/*
%{_bindir}/*
%{python_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
%{_bindir}/csv2rdf
%{_bindir}/rdf2dot
%{_bindir}/rdfgraphisomorphism
%{_bindir}/rdfpipe
%{_bindir}/rdfs2dot
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc LICENSE
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%{_bindir}/python3-csv2rdf
%{_bindir}/python3-rdf2dot
%{_bindir}/python3-rdfgraphisomorphism
%{_bindir}/python3-rdfpipe
%{_bindir}/python3-rdfs2dot
%endif
%changelog
* Mon Jan 05 2015 Matthias Runge <mrunge@redhat.com> - 4.1.2-3
- add python3 subpackage (rhbz#1086844)
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

Loading…
Cancel
Save