[packages/python-IPy] - up to 0.83; build python3 package, too

arekm arekm at pld-linux.org
Wed Jan 16 11:47:22 CET 2019


commit 3506e45dbaef6e396b798e4d9eb76d6c54406860
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Jan 16 11:47:14 2019 +0100

    - up to 0.83; build python3 package, too

 python-IPy.spec | 95 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 80 insertions(+), 15 deletions(-)
---
diff --git a/python-IPy.spec b/python-IPy.spec
index e5c90be..ef99217 100644
--- a/python-IPy.spec
+++ b/python-IPy.spec
@@ -1,19 +1,36 @@
-%define		module	IPy
+# Conditional build:
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
+# NOTES:
+# - 'module' should match the Python import path (first component?)
+# - 'egg_name' should equal to Python egg name
+# - 'pypi_name' must match the Python Package Index name
+%define		module		IPy
+%define		egg_name	IPy
+%define		pypi_name	IPy
 Summary:	Class and tools for handling of IPv4 and IPv6 addresses and networks
 Summary(pl.UTF-8):	Klasy i narzędzia do obsługi adresów i sieci IPv4 i IPv6
-Name:		python-%{module}
-Version:	0.80
-Release:	3
+Name:		python-%{pypi_name}
+Version:	0.83
+Release:	1
 License:	BSD
 Group:		Libraries/Python
-Source0:	http://cheeseshop.python.org/packages/source/I/IPy/%{module}-%{version}.tar.gz
-# Source0-md5:	3ac024861a8ca833b3f041d0fe2ce04c
+Source0:	https://pypi.debian.net/IPy/%{module}-%{version}.tar.gz
+# Source0-md5:	7b8c6eb4111b15aea31b67108e769712
 URL:		https://github.com/haypo/python-ipy/wiki
-BuildRequires:	python-devel >= 1:2.5
-BuildRequires:	python-setuptools
 BuildRequires:	rpm-pythonprov
-BuildRequires:	rpmbuild(macros) >= 1.710
-%pyrequires_eq	python-modules
+BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with python2}
+BuildRequires:	python-modules
+BuildRequires:	python-setuptools
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules
+BuildRequires:	python3-setuptools
+%endif
+Requires:	python-modules
+BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -30,25 +47,73 @@ części zainspirowana interfejsem modułu Perla RIPE Net::IP, ale nie
 współdzieli z nim implementacji. Nie dzieli masek sieciowych nie-CIDR,
 więc zabawne rzeczy typu maska 0xffffff0f są tutaj niewykonalne.
 
+%package -n python3-%{pypi_name}
+Summary:	-
+Summary(pl.UTF-8):	-
+Group:		Libraries/Python
+Requires:	python3-modules
+
+%description -n python3-%{pypi_name}
+The IP class allows a comfortable parsing and handling for most
+notations in use for IPv4 and IPv6 Addresses and Networks. It was
+greatly inspired bei RIPE's Perl module Net::IP's interface but
+doesn't share the Implementation. It doesn't share non-CIDR netmasks,
+so funky stuff lixe a netmask 0xffffff0f can't be done here.
+
+%description -n python3-%{pypi_name} -l pl.UTF-8
+Klasa IP pozwala w wygodny sposób analizować i obsługiwać większość
+używanych notacji zapisu adresów i sieci IPv4 i IPv6. Jest w dużej
+części zainspirowana interfejsem modułu Perla RIPE Net::IP, ale nie
+współdzieli z nim implementacji. Nie dzieli masek sieciowych nie-CIDR,
+więc zabawne rzeczy typu maska 0xffffff0f są tutaj niewykonalne.
+
 %prep
-%setup -q -n %{module}-%{version}
+%setup -q -n %{pypi_name}-%{version}
 
 %build
+%if %{with python2}
 %py_build
+%endif
+
+%if %{with python3}
+%py3_build
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
-%py_install \
-	--root $RPM_BUILD_ROOT
+%if %{with python2}
+%py_install
+
+# when files are installed in other way that standard 'setup.py
+# they need to be (re-)compiled
+# change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
+%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
+%py_comp $RPM_BUILD_ROOT%{py_sitedir}
 
 %py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python2}
 %files
 %defattr(644,root,root,755)
 %doc ChangeLog README AUTHORS COPYING
-%attr(755,root,root) %{py_sitescriptdir}/*.py[co]
-%{py_sitescriptdir}/*.egg-info
+%{py_sitescriptdir}/%{module}.py*
+%{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-%{pypi_name}
+%defattr(644,root,root,755)
+%doc ChangeLog README AUTHORS COPYING
+%{py3_sitescriptdir}/%{module}.py*
+%{py3_sitescriptdir}/__pycache__/%{module}.*.pyc
+%{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-IPy.git/commitdiff/3506e45dbaef6e396b798e4d9eb76d6c54406860



More information about the pld-cvs-commit mailing list