]> git.pld-linux.org Git - SPECS.git/blob - python-pystun.spec
SPECS updated Wed 28 Jul 14:48:01 CEST 2021
[SPECS.git] / python-pystun.spec
1 # Conditional build:
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
6
7 # NOTES:
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
11 %define         module          stun
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}
16 Version:        0.1.0
17 Release:        1
18 License:        MIT
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
25 %if %{with python2}
26 BuildRequires:  python-modules
27 BuildRequires:  python-setuptools
28 %endif
29 %if %{with python3}
30 BuildRequires:  python3-modules
31 BuildRequires:  python3-setuptools
32 %endif
33 Requires:       python-modules
34 BuildArch:      noarch
35 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36
37 %description
38 A Python STUN client for getting NAT type and external IP. PyStun follows RFC 3489.
39
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
44
45 %description -n python3-%{pypi_name}
46 A Python STUN client for getting NAT type and external IP. PyStun follows RFC 3489.
47
48 %prep
49 %setup -q -n %{pypi_name}-%{version}
50
51 # fix #!/usr/bin/env python -> #!/usr/bin/python:
52 #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
53
54 %build
55 %if %{with python2}
56 %py_build %{?with_tests:test}
57 %endif
58
59 %if %{with python3}
60 %py3_build %{?with_tests:test}
61 %endif
62
63 %install
64 rm -rf $RPM_BUILD_ROOT
65
66 %if %{with python2}
67 %py_install
68
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}
74
75 %py_postclean
76 %endif
77
78 %if %{with python3}
79 %py3_install
80 %endif
81
82 %clean
83 rm -rf $RPM_BUILD_ROOT
84
85 %if %{with python2}
86 %files
87 %defattr(644,root,root,755)
88 %doc README.rst
89 %{py_sitescriptdir}/%{module}
90 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
91 %endif
92
93 %if %{with python3}
94 %files -n python3-%{pypi_name}
95 %defattr(644,root,root,755)
96 %doc README.rst
97 %attr(755,root,root) %{_bindir}/pystun
98 %{py3_sitescriptdir}/%{module}
99 %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
100 %endif
This page took 0.966654 seconds and 3 git commands to generate.