[python-polib] Add python3 support

Ding-Yi Chen dchen at fedoraproject.org
Tue Jul 16 06:02:59 UTC 2013


commit 38e2496c5df489a7c9671e532e1e23ce01fdfa9f
Author: Ding-Yi Chen <dingyichen at gmail.com>
Date:   Tue Jul 16 16:02:36 2013 +1000

    Add python3 support

 .gitignore        |    1 +
 python-polib.spec |   44 ++++++++++++++++++++++++++++++++++++++++++++
 sources           |    2 +-
 3 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 96ce5c0..4e7465d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ polib-0.5.1.tar.gz
 /polib-0.7.0.tar.gz
 /polib-1.0.0.tar.gz
 /polib-1.0.3.tar.gz
+/python-polib.spec
diff --git a/python-polib.spec b/python-polib.spec
index 23e9d5c..2517744 100644
--- a/python-polib.spec
+++ b/python-polib.spec
@@ -27,17 +27,55 @@ 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.
 
+
+%package     -n python3-polib
+Summary:        A library to parse and manage gettext catalogs in python 3
+Group:          Development/Languages
+BuildRequires:  python3-devel
+Requires:       %{name} = %{version}-%{release}
+
+%description -n python3-polib
+polib allows you to manipulate, create, modify gettext files (pot, po and
+mo files). You can load existing files, iterate through it's entries, add,
+modify entries, comments or metadata, etc... or create new po files from
+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.
+
 %prep
 %setup -q -n polib-%{version}
 #%patch0 -p1 -b .%{version}_dbafdc621bf4
 
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+
 %build
 %{__python} setup.py build
 
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+
+
+%check
+%{__python} setup.py check
+
+pushd %{py3dir}
+%{__python3} setup.py check
+popd
+
 %install
 rm -rf $RPM_BUILD_ROOT
 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
 
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+popd
+
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -46,8 +84,14 @@ rm -rf $RPM_BUILD_ROOT
 %doc LICENSE README.rst
 %{python_sitelib}/*
 
+%files -n python3-polib
+%defattr(-,root,root,-)
+%doc LICENSE README.rst
+%{python3_sitelib}/*
+
 %changelog
 * Tue Jul 16 2013 Ding-Yi Chen <dchen at redhat.com> - 1.0.3-1
+- python3 binding is available (python3-polib)
 - Fixed Bug 978672 - This package should be updated.
 - Upstream update to 1.0.3
 - Version 1.0.3 (2013/02/09)
diff --git a/sources b/sources
index ce1b95b..c615429 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-dc9dc39d4053cfe030155891f3043cb1  polib-1.0.3.tar.gz
+599c988bb25c3f0ac5cf163c26ae5f76  python-polib.spec


More information about the scm-commits mailing list