]> git.pld-linux.org Git - packages/python-iptables.git/blob - python-iptables.spec
- initial; doesn't work with python3
[packages/python-iptables.git] / python-iptables.spec
1 #
2 # Conditional build:
3 %bcond_without  doc             # don't build doc
4 %bcond_without  python2 # CPython 2.x module
5 %bcond_with     python3 # CPython 3.x module
6
7 %define         module  iptables
8 Summary:        Python bindings for iptables
9 Name:           python-%{module}
10 Version:        0.3.0
11 Release:        1
12 License:        APL
13 Group:          Libraries/Python
14 Source0:        https://github.com/ldx/python-iptables/archive/v%{version}.tar.gz
15 # Source0-md5:  55aa8421c0f2dea90aa204b87fc43abf
16 URL:            https://github.com/ldx/python-iptables
17 BuildRequires:  rpm-pythonprov
18 BuildRequires:  rpmbuild(macros) >= 1.219
19 %if %{with python2}
20 BuildRequires:  python-devel
21 BuildRequires:  python-distribute
22 %endif
23 %if %{with python3}
24 BuildRequires:  python3-devel
25 BuildRequires:  python3-distribute
26 BuildRequires:  python3-modules
27 %endif
28 Requires:       python-modules
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31 %description
32 Python bindings for iptables.
33
34 %package -n python3-%{module}
35 Summary:        Python bindings for iptables
36 Group:          Libraries/Python
37 Requires:       python3-modules
38
39 %description -n python3-%{module}
40 Python bindings for iptables.
41
42 %package apidocs
43 Summary:        %{module} API documentation
44 Summary(pl.UTF-8):      Dokumentacja API %{module}
45 Group:          Documentation
46
47 %description apidocs
48 API documentation for %{module}.
49
50 %description apidocs -l pl.UTF-8
51 Dokumentacja API %{module}.
52
53 %prep
54 %setup -q
55
56 %build
57 %if %{with python2}
58 # CC/CFLAGS is only for arch packages - remove on noarch packages
59 CC="%{__cc}" \
60 CFLAGS="%{rpmcppflags} %{rpmcflags}" \
61 %{__python} setup.py build --build-base build-2
62 %endif
63
64 %if %{with python3}
65 # CC/CFLAGS is only for arch packages - remove on noarch packages
66 CC="%{__cc}" \
67 CFLAGS="%{rpmcppflags} %{rpmcflags}" \
68 %{__python3} setup.py build --build-base build-3
69 %endif
70
71 %if %{with doc}
72 cd doc
73 %{__make} -j1 html
74 rm -rf _build/html/_sources
75 %endif
76
77 %install
78 rm -rf $RPM_BUILD_ROOT
79
80 %if %{with python2}
81 %{__python} setup.py \
82         build --build-base build-2 \
83         install --skip-build \
84         --optimize=2 \
85         --root=$RPM_BUILD_ROOT
86
87 %py_postclean
88 %endif
89
90 %if %{with python3}
91 %{__python3} setup.py \
92         build --build-base build-3 \
93         install --skip-build \
94         --optimize=2 \
95         --root=$RPM_BUILD_ROOT
96 %endif
97
98 %clean
99 rm -rf $RPM_BUILD_ROOT
100
101 %if %{with python2}
102 %files
103 %defattr(644,root,root,755)
104 %doc README.md
105 %dir %{py_sitedir}/iptc
106 %{py_sitedir}/iptc/*.py[co]
107 %attr(755,root,root) %{py_sitedir}/*.so
108 %if "%{py_ver}" > "2.4"
109 %{py_sitedir}/python_%{module}-%{version}-py*.egg-info
110 %endif
111 %endif
112
113 %if %{with python3}
114 %files -n python3-%{module}
115 %defattr(644,root,root,755)
116 %doc README.md
117 %{py3_sitedir}/%{module}
118 %{py3_sitedir}/python_%{module}-%{version}-py*.egg-info
119 %endif
120
121 %if %{with doc}
122 %files apidocs
123 %defattr(644,root,root,755)
124 %doc doc/_build/html/*
125 %endif
This page took 0.14556 seconds and 3 git commands to generate.