2 %bcond_without doc # Sphinx documentation
3 %bcond_with tests # unit tests
4 %bcond_without python2 # CPython 2.x module
5 %bcond_without python3 # CPython 3.x module
8 # - 'module' should match the Python import path (first component?)
9 # - 'egg_name' should equal to Python egg name
10 # - 'pypi_name' must match the Python Package Index name
12 %define egg_name pystun
13 %define pypi_name pystun
14 Summary: A Python STUN client for getting NAT type and external IP
15 Name: python-%{pypi_name}
19 Group: Libraries/Python
20 Source0: https://pypi.debian.net/pystun/%{pypi_name}-%{version}.tar.gz
21 # Source0-md5: 5cefad003e24b1aa04577ddf21a65779
22 URL: https://github.com/jtriley/pystun
23 BuildRequires: rpm-pythonprov
24 BuildRequires: rpmbuild(macros) >= 1.714
26 BuildRequires: python-modules
27 BuildRequires: python-setuptools
30 BuildRequires: python3-modules
31 BuildRequires: python3-setuptools
33 Requires: python-modules
35 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
38 A Python STUN client for getting NAT type and external IP. PyStun follows RFC 3489.
40 %package -n python3-%{pypi_name}
41 Summary: A Python STUN client for getting NAT type and external IP
42 Group: Libraries/Python
43 Requires: python3-modules
45 %description -n python3-%{pypi_name}
46 A Python STUN client for getting NAT type and external IP. PyStun follows RFC 3489.
49 %setup -q -n %{pypi_name}-%{version}
51 # fix #!/usr/bin/env python -> #!/usr/bin/python:
52 #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
56 %py_build %{?with_tests:test}
60 %py3_build %{?with_tests:test}
64 rm -rf $RPM_BUILD_ROOT
69 # when files are installed in other way that standard 'setup.py
70 # they need to be (re-)compiled
71 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
72 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
73 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
83 rm -rf $RPM_BUILD_ROOT
87 %defattr(644,root,root,755)
89 %{py_sitescriptdir}/%{module}
90 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
94 %files -n python3-%{pypi_name}
95 %defattr(644,root,root,755)
97 %attr(755,root,root) %{_bindir}/pystun
98 %{py3_sitescriptdir}/%{module}
99 %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info