templates/python: multiversion package build

Add the rpm macros required for building both Python2 and Python3 packages
with a single specfile:

  python2:  rpmbuild -ba <specfile>
  python3:  rpmbuild -ba <specfile> --define="with_pyver 3"

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2016-02-16 19:34:06 +01:00
parent 28a476679d
commit c357ffbc08
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,13 @@
Changes in version 1.16.7
--- --- -- 2016 Madrisan <davide.madrisan(a)gmail.com>
+ improvement
* templates/python - Davide Madrisan
Add the rpm macros required for building both Python2 and Python3 packages
with a single specfile.
-------------------------------------------------------------------------------
Changes in version 1.16.6
Thu May 07 2015 Madrisan <davide.madrisan(a)gmail.com>

View File

@ -19,6 +19,10 @@ BuildRoot: @rpm_default_buildroot@
%description
%{summary}.
%if 0%{?with_pyver}
%pyver_package
%endif
%prep
%setup -q
@ -30,13 +34,13 @@ CFLAGS="%{optflags}" %{__python} setup.py build
%{__python} setup.py install \\
\ -O1 --skip-build \\
\ --root="%{buildroot}" \\
\ --install-headers=%{_includedir}/python \\
\ --install-headers=%{python_inc} \\
\ --install-lib=%{python_sitearch} \\
\ --record=%{name}.filelist
sed -i "\\,\\.egg-info/,d;s,.*/man/.*,&.gz," %{name}.filelist
%files -f %{name}.filelist
%files %{?pyappend} -f %{name}.filelist
%defattr(-,root,root)
## note: this list is just an example; modify as required
# %{python_sitearch}/%{name}.py*