From 16d1f70bf7ca575d27a3a129cdb3e26a51384917 Mon Sep 17 00:00:00 2001 From: Ding-Yi Chen Date: Jul 16 2013 08:11:30 +0000 Subject: Fixed build for el6 --- diff --git a/python-polib.spec b/python-polib.spec index 2517744..aab5cba 100644 --- a/python-polib.spec +++ b/python-polib.spec @@ -1,10 +1,21 @@ %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -#%define alphatag r60 +%if 0%{?rhel} +%if 0%{?rhel} <= 5 + %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif +%else %if 0%{?fedora} +%if 0%{?fedora} >12 +%global with_python3 1 +%else +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} +%endif +%endif Name: python-polib Version: 1.0.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A library to parse and manage gettext catalogs Group: Development/Languages @@ -27,7 +38,7 @@ polib provides a simple and pythonic API, exporting only three convenience functions 'pofile', 'mofile' and 'detect_encoding', and the 4 core classes: POFile, MOFile, POEntry and MOEntry for creating new files/entries. - +%if 0%{?with_python3} %package -n python3-polib Summary: A library to parse and manage gettext catalogs in python 3 Group: Development/Languages @@ -43,38 +54,48 @@ scratch. polib provides a simple and pythonic API, exporting only three convenience functions 'pofile', 'mofile' and 'detect_encoding', and the 4 core classes: POFile, MOFile, POEntry and MOEntry for creating new files/entries. +%endif %prep %setup -q -n polib-%{version} #%patch0 -p1 -b .%{version}_dbafdc621bf4 +%if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +%endif %build %{__python} setup.py build +%if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd - +%endif %check +%if 0%{?fedora} %{__python} setup.py check +%if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py check popd +%endif +%endif %install rm -rf $RPM_BUILD_ROOT %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT + +%if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd - +%endif %clean rm -rf $RPM_BUILD_ROOT @@ -84,12 +105,17 @@ rm -rf $RPM_BUILD_ROOT %doc LICENSE README.rst %{python_sitelib}/* +%if 0%{?with_python3} %files -n python3-polib %defattr(-,root,root,-) %doc LICENSE README.rst %{python3_sitelib}/* +%endif %changelog +* Tue Jul 16 2013 Ding-Yi Chen - 1.0.3-2 +- Fix the build for EL6 and EL5 (without python3-polib) + * Tue Jul 16 2013 Ding-Yi Chen - 1.0.3-1 - python3 binding is available (python3-polib) - Fixed Bug 978672 - This package should be updated.