]> git.pld-linux.org Git - projects/template-specs.git/blame - python.spec
- due to our ftp infrastructure limitation append '-kernel' prefix to
[projects/template-specs.git] / python.spec
CommitLineData
4cdaa512
ER
1#
2# Conditional build:
3%bcond_without tests # do not perform "make test"
d328d943 4%bcond_without python3 # CPython 3.x module
4cdaa512 5
b81eefa5 6%define module template
7170a7b1
ER
7Summary: -
8Summary(pl.UTF-8): -
3256a2f0 9# Name must match the python module/package name (as in 'import' statement)
b81eefa5 10Name: python-%{module}
7170a7b1
ER
11Version: _
12Release: 0.1
13License: - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here)
6177d217 14Group: Libraries/Python
7170a7b1
ER
15Source0: %{name}-%{version}.tar.gz
16# Source0-md5: -
7170a7b1 17URL: -
dbb3e196 18# remove BR: python-devel for 'noarch' packages.
278010a4 19BuildRequires: python-devel
dbb3e196 20BuildRequires: python-distribute
0a48bf0d 21BuildRequires: rpm-pythonprov
7592d76f
JB
22# if py_postclean is used
23BuildRequires: rpmbuild(macros) >= 1.219
d328d943
ER
24# when python3 present
25BuildRequires: sed >= 4.0
26%if %{with python3}
27BuildRequires: python3-devel
28BuildRequires: python3-distribute
29BuildRequires: python3-modules
30%endif
10305643 31#Requires: python-libs
32Requires: python-modules
7170a7b1
ER
33#BuildArch: noarch
34BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
36%description
37
e6f4b058 38%description -l pl.UTF-8
39
d328d943
ER
40%package apidoc
41Summary: %{module} API documentation
42Summary(pl.UTF-8): Dokumentacja API %{module}
43Group: Documentation
44
45%description apidoc
46API documentation for %{module}.
47
48%description apidoc -l pl.UTF-8
49Dokumentacja API %{module}.
50
7170a7b1 51%prep
641675c1 52%setup -q -n %{module}-%{version}
7170a7b1 53
5a020810 54# fix #!/usr/bin/env python -> #!/usr/bin/python:
cb13b64b 55#%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
5a020810 56
d328d943
ER
57%if %{with python3}
58rm -rf build-3
59set -- *
60install -d build-3
61cp -a "$@" build-3
62find build-3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
63%endif
64
7170a7b1 65%build
d328d943
ER
66%if %{with python2}
67%{__python} setup.py build --build-base build-2
68%endif
69%if %{with python3}
70%{__python3} setup.py build --build-base build-3
71%endif
72
46094905
ER
73# CC/CFLAGS is only for arch packages - remove on noarch packages
74CC="%{__cc}" \
75CFLAGS="%{rpmcflags}" \
7592d76f 76%{__python} setup.py build
d328d943
ER
77%{__python} setup.py \
78 build -b build-2
7170a7b1 79
a4ec70eb
ER
80%{?with_tests:%{__python} setup.py test}
81
d328d943
ER
82%if %{with python3}
83%{__python3} setup.py \
84 build -b build-3
85
86%if %{with tests}
87%{__python3} setup.py test
88%endif
89%endif
90
91%if %{with doc}
92cd docs
93%{__make} -j1 html
94rm -rf _build/html/_sources
95%endif
96
7170a7b1
ER
97%install
98rm -rf $RPM_BUILD_ROOT
7592d76f 99%{__python} setup.py install \
e7663425 100 --skip-build \
7170a7b1
ER
101 --optimize=2 \
102 --root=$RPM_BUILD_ROOT
103
d328d943
ER
104%{__python} -- setup.py \
105 build -b build-2 \
106 install \
107 --root=$RPM_BUILD_ROOT \
108 --optimize=2
109
110%if %{with python2}
111%{__python} setup.py \
112 build --build-base build-2 \
113 install \
114 --root=$RPM_BUILD_ROOT \
115 --optimize=2
116
117%py_postclean
118%endif
119
120%{__python3} -- setup.py \
121 build -b build-3 \
122 install \
123 --root=$RPM_BUILD_ROOT \
124 --optimize=2
125
126%if %{with python3}
127%{__python3} setup.py \
128 build --build-base build-3 \
129 install \
130 --root=$RPM_BUILD_ROOT \
131 --optimize=2
132%endif
133
8424aa58
ER
134install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
135cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
136
9a83d846 137# change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
e5a26a61
ER
138%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
139%py_comp $RPM_BUILD_ROOT%{py_sitedir}
140%py_postclean
141
7170a7b1
ER
142%clean
143rm -rf $RPM_BUILD_ROOT
144
7170a7b1
ER
145%files
146%defattr(644,root,root,755)
147%doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
9a83d846 148# change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
e5a26a61
ER
149%{py_sitedir}/*.py[co]
150%attr(755,root,root) %{py_sitedir}/*.so
ef0b62a1 151%if "%{py_ver}" > "2.4"
47501bae 152%{py_sitedir}/TEMPLATE-*.egg-info
ef278603 153%endif
8424aa58 154%{_examplesdir}/%{name}-%{version}
d328d943
ER
155
156%if %{with python2}
157%files
158%defattr(644,root,root,755)
159%doc AUTHORS CHANGES LICENSE
160%{py_sitescriptdir}/%{module}
161%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
162%endif
163
164%if %{with python3}
165%files -n python3-%{module}
166%defattr(644,root,root,755)
167%doc AUTHORS CHANGES LICENSE
168%{py3_sitescriptdir}/%{module}
169%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
170%endif
171
172%if %{with doc}
173%files apidoc
174%defattr(644,root,root,755)
175%doc docs/_build/html/*
176%endif
This page took 0.375364 seconds and 4 git commands to generate.