[python-ntplib] Python 3 subpackage

Miro Hrončok churchyard at fedoraproject.org
Sat Jun 28 19:27:40 UTC 2014


commit b6328b5ef9166a1f05d3e7bb8ce4b505ae974acc
Author: Miro Hrončok <miro at hroncok.cz>
Date:   Sat Jun 28 21:27:29 2014 +0200

    Python 3 subpackage

 python-ntplib.spec |   66 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 62 insertions(+), 4 deletions(-)
---
diff --git a/python-ntplib.spec b/python-ntplib.spec
index 4314581..588c645 100644
--- a/python-ntplib.spec
+++ b/python-ntplib.spec
@@ -1,6 +1,9 @@
+%global with_python3 1
+# tests require internet connection
+%global with_tests 0
 Name:           python-ntplib
 Version:        0.3.2
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Python module that offers a simple interface to query NTP servers
 
 License:        LGPLv2+
@@ -11,30 +14,85 @@ BuildArch:      noarch
 BuildRequires:  python2-devel
 BuildRequires:  python-setuptools
 
+%if 0%{?with_python3}
+BuildRequires:	python3-devel
+BuildRequires:	python3-setuptools
+%endif # with_python3
+
 %description
 The ntplib is a python module that offers a simple interface to query NTP
 servers. It also provides utility functions to translate NTP fields' values to
 text (mode, leap indicator...). Since it's pure Python, and only depends on core
 modules, it should work on any platform with a Python implementation.
 
+
+%if 0%{?with_python3}
+%package -n python3-ntplib
+Summary:        Python 3 module that offers a simple interface to query NTP servers
+
+%description -n python3-ntplib
+The ntplib is a python module that offers a simple interface to query NTP
+servers. It also provides utility functions to translate NTP fields' values to
+text (mode, leap indicator...). Since it's pure Python, and only depends on core
+modules, it should work on any platform with a Python implementation.
+
+Python 3 version.
+
+%endif # with_python3
+
+
 %prep
 %setup -q -n ntplib-%{?version}
 
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+%endif # with_python3
 
 %build
-%{__python} setup.py build
+%{__python2} setup.py build
 
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
 
 %install
-%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+popd
+%endif # with_python3
 
+%if 0%{?with_tests}
+%check
+%{__python2} test_ntplib.py
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} test_ntplib.py
+popd
+%endif # with_python3
+%endif # with_tests
 
 %files
 %doc CHANGELOG COPYING.LESSER
-%{python_sitelib}/*
+%{python2_sitelib}/*
 
+%if 0%{?with_python3}
+%files -n python3-ntplib
+%doc CHANGELOG COPYING.LESSER
+%{python3_sitelib}/*
+%endif # with_python3
 
 %changelog
+* Sat Jun 28 2014 Miro Hrončok <mhroncok at redhat.com> - 0.3.2-3
+- Introduced Python 3 subpackage
+- Conditional %%check section
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.3.2-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list