added python3 support (rhbz #1010302)
This commit is contained in:
parent
1b7eda09c1
commit
22ba0882dd
@ -1,22 +1,33 @@
|
|||||||
|
%global with_python3 1
|
||||||
|
|
||||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||||
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
||||||
|
|
||||||
Name: python-iniparse
|
Name: python-iniparse
|
||||||
Version: 0.4
|
Version: 0.4
|
||||||
Release: 8%{?dist}
|
Release: 9%{?dist}
|
||||||
Summary: Python Module for Accessing and Modifying Configuration Data in INI files
|
Summary: Python Module for Accessing and Modifying Configuration Data in INI files
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: http://code.google.com/p/iniparse/
|
URL: http://code.google.com/p/iniparse/
|
||||||
Source0: http://iniparse.googlecode.com/files/iniparse-%{version}.tar.gz
|
Source0: http://iniparse.googlecode.com/files/iniparse-%{version}.tar.gz
|
||||||
Patch0: fix-issue-28.patch
|
Patch0: fix-issue-28.patch
|
||||||
|
# The patch upstream (http://code.google.com/p/iniparse/issues/detail?id=22)
|
||||||
|
# is Python3-only. The patch below uses python-six to create a version that works
|
||||||
|
# with both Python major versions and is more error-prone.
|
||||||
|
Patch1: %{name}-python3-compat.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
%if 0%{?fedora} >= 8
|
BuildRequires: python-setuptools
|
||||||
BuildRequires: python-setuptools-devel
|
BuildRequires: python-six
|
||||||
%else
|
BuildRequires: python2-devel
|
||||||
BuildRequires: python-setuptools
|
|
||||||
|
Requires: python-six
|
||||||
|
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
BuildRequires: python3-setuptools
|
||||||
|
BuildRequires: python3-six
|
||||||
|
BuildRequires: python3-devel
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -28,16 +39,51 @@ files (order of sections & options, indentation, comments, and blank
|
|||||||
lines are preserved when data is updated), and is more convenient to
|
lines are preserved when data is updated), and is more convenient to
|
||||||
use.
|
use.
|
||||||
|
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
%package -n python3-iniparse
|
||||||
|
Summary: Python 3 Module for Accessing and Modifying Configuration Data in INI files
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: python3-six
|
||||||
|
|
||||||
|
%description -n python3-iniparse
|
||||||
|
iniparse is an INI parser for Python 3 which is API compatible
|
||||||
|
with the standard library's configparser, preserves structure of INI
|
||||||
|
files (order of sections & options, indentation, comments, and blank
|
||||||
|
lines are preserved when data is updated), and is more convenient to
|
||||||
|
use.
|
||||||
|
%endif
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n iniparse-%{version}
|
%setup -q -n iniparse-%{version}
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p0
|
||||||
chmod -c -x html/index.html
|
chmod -c -x html/index.html
|
||||||
|
|
||||||
|
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
rm -rf %{py3dir}
|
||||||
|
cp -a . %{py3dir}
|
||||||
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python} setup.py build
|
%{__python2} setup.py build
|
||||||
|
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
pushd %{py3dir}
|
||||||
|
%{__python3} setup.py build
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
pushd %{py3dir}
|
||||||
|
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||||
|
mv $RPM_BUILD_ROOT/usr/share/doc/iniparse-%{version} $RPM_BUILD_ROOT/%{_docdir}/python3-iniparse
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||||
mv $RPM_BUILD_ROOT/usr/share/doc/iniparse-%{version} $RPM_BUILD_ROOT%{_pkgdocdir}
|
mv $RPM_BUILD_ROOT/usr/share/doc/iniparse-%{version} $RPM_BUILD_ROOT%{_pkgdocdir}
|
||||||
|
|
||||||
@ -50,9 +96,19 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%doc %{_pkgdocdir}
|
%doc %{_pkgdocdir}
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/*
|
||||||
|
|
||||||
|
%if 0%{?with_python3}
|
||||||
|
%files -n python3-iniparse
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%doc %{_docdir}/python3-iniparse
|
||||||
|
%{python3_sitelib}/*
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 20 2013 Bohuslav Kabrda <bkabrda@redhat.com> - 0.4-9
|
||||||
|
- Introduce python3 subpackage.
|
||||||
|
- Use %%__python2 instead of %%__python.
|
||||||
|
|
||||||
* Mon Jul 29 2013 Ville Skyttä <ville.skytta@iki.fi> - 0.4-8
|
* Mon Jul 29 2013 Ville Skyttä <ville.skytta@iki.fi> - 0.4-8
|
||||||
- Install docs to %%{_pkgdocdir} where available.
|
- Install docs to %%{_pkgdocdir} where available.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user