[packages/python-networkx] - added python3 package

baggins baggins at pld-linux.org
Sun Sep 22 12:11:40 CEST 2019


commit c295a98f88d46d8ae3321b01506a86dd271e03e3
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Sep 22 12:10:17 2019 +0200

    - added python3 package

 python-networkx.spec | 99 ++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 88 insertions(+), 11 deletions(-)
---
diff --git a/python-networkx.spec b/python-networkx.spec
index 10e8460..9e32bd6 100644
--- a/python-networkx.spec
+++ b/python-networkx.spec
@@ -1,8 +1,10 @@
-# TODO:
-# - add docs
-# - package examples
+#
+# Conditional build:
+%bcond_with	doc	# Sphinx documentation, TODO: fix this
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
 
-%define 	module	networkx
+%define		module	networkx
 Summary:	High-productivity software for complex networks
 Summary(pl.UTF-8):	Efektywne operacje na skompliwkoanych grafach.
 Name:		python-%{module}
@@ -13,9 +15,16 @@ Group:		Libraries/Python
 Source0:	https://pypi.python.org/packages/source/n/networkx/%{module}-%{version}.tar.gz
 # Source0-md5:	b4a9e68ecd1b0164446ee432d2e20bd0
 URL:		http://networkx.github.io/index.html
-BuildRequires:	python-distribute
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.710
+%if %{with python2}
+BuildRequires:	python-distribute
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules
+BuildRequires:	python3-setuptools
+%endif
+%{?with_doc:BuildRequires:	python-matplotlib}
 Requires:	python-modules
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -28,31 +37,99 @@ study of the structure, dynamics, and functions of complex networks.
 Pakiet oprogramowania do tworzenia, manipulacji i badania struktury
 dynamiki i funkcji zlozonych sieci.
 
+%package -n python3-%{module}
+Summary:	High-productivity software for complex networks
+Summary(pl.UTF-8):	Efektywne operacje na skompliwkoanych grafach.
+Group:		Libraries/Python
+Requires:	python3-modules
+
+%description -n python3-%{module}
+Python language software package for the creation, manipulation, and
+study of the structure, dynamics, and functions of complex networks.
+
+%description -n python3-%{module} -l pl.UTF-8
+Pakiet oprogramowania do tworzenia, manipulacji i badania struktury
+dynamiki i funkcji zlozonych sieci.
+
+%package apidocs
+Summary:	API documentation for Python %{module} module
+Summary(pl.UTF-8):	Dokumentacja API modułu Pythona %{module}
+Group:		Documentation
+
+%description apidocs
+API documentation for Python %{module} module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona %{module}.
+
 %prep
 %setup -q -n %{module}-%{version}
 
 %build
+%if %{with python2}
 %py_build
+%endif
+
+%if %{with python3}
+%py3_build
+%endif
+
+%if %{with doc}
+cd doc
+%{__make} -j1 html
+rm -rf _build/html/_sources
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%py_install
 
-install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
-cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+%if %{with python2}
+%py_install
 
 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
 %py_postclean
 
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
+find $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} -name '*.py' \
+	| xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
+%endif
+
+%if %{with python3}
+%py3_install
+
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
+find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
+	| xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
+%endif
+
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{module}-%{version}
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python2}
 %files
 %defattr(644,root,root,755)
-# %doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
+%doc README.txt
 %{py_sitescriptdir}/%{module}
-%if "%{py_ver}" > "2.4"
 %{py_sitescriptdir}/%{module}-*.egg-info
+%{_examplesdir}/python-%{module}-%{version}
+%endif
+
+%if %{with python3}
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%doc README.txt
+%{py3_sitescriptdir}/%{module}
+%{py3_sitescriptdir}/%{module}-*.egg-info
+%{_examplesdir}/python3-%{module}-%{version}
+%endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/*
 %endif
-%{_examplesdir}/%{name}-%{version}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-networkx.git/commitdiff/88dcc2eacb37a54c93921e72dcdf27d39486cbfd



More information about the pld-cvs-commit mailing list