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 Changes in version 1.16.6
Thu May 07 2015 Madrisan <davide.madrisan(a)gmail.com> Thu May 07 2015 Madrisan <davide.madrisan(a)gmail.com>

View File

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