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