279453f
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
279453f
16d1f70
%if 0%{?rhel}
16d1f70
%if 0%{?rhel} <= 5
16d1f70
  %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
16d1f70
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
16d1f70
%endif
16d1f70
%else %if 0%{?fedora}
16d1f70
%if 0%{?fedora} >12
16d1f70
%global with_python3 1
16d1f70
%else
16d1f70
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
16d1f70
%endif
16d1f70
%endif
279453f
279453f
Name:           python-polib
12556cd
Version:        1.0.3
16d1f70
Release:        2%{?dist}
279453f
Summary:        A library to parse and manage gettext catalogs
279453f
279453f
Group:          Development/Languages
279453f
License:        MIT
561737c
URL:            http://bitbucket.org/izi/polib/
561737c
Source0:        http://bitbucket.org/izi/polib/downloads/polib-%{version}.tar.gz
279453f
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
784039b
#Patch0:         polib-%{version}_dbafdc621bf4.patch
279453f
279453f
BuildArch:      noarch
279453f
BuildRequires:  python-devel
279453f
279453f
%description
279453f
polib allows you to manipulate, create, modify gettext files (pot, po and
279453f
mo files). You can load existing files, iterate through it's entries, add,
279453f
modify entries, comments or metadata, etc... or create new po files from
279453f
scratch.
279453f
279453f
polib provides a simple and pythonic API, exporting only three convenience
279453f
functions 'pofile', 'mofile' and 'detect_encoding', and the 4 core classes:
279453f
POFile, MOFile, POEntry and MOEntry for creating new files/entries.
279453f
16d1f70
%if 0%{?with_python3}
38e2496
%package     -n python3-polib
38e2496
Summary:        A library to parse and manage gettext catalogs in python 3
38e2496
Group:          Development/Languages
38e2496
BuildRequires:  python3-devel
38e2496
Requires:       %{name} = %{version}-%{release}
38e2496
38e2496
%description -n python3-polib
38e2496
polib allows you to manipulate, create, modify gettext files (pot, po and
38e2496
mo files). You can load existing files, iterate through it's entries, add,
38e2496
modify entries, comments or metadata, etc... or create new po files from
38e2496
scratch.
38e2496
38e2496
polib provides a simple and pythonic API, exporting only three convenience
38e2496
functions 'pofile', 'mofile' and 'detect_encoding', and the 4 core classes:
38e2496
POFile, MOFile, POEntry and MOEntry for creating new files/entries.
16d1f70
%endif
38e2496
279453f
%prep
86090d0
%setup -q -n polib-%{version}
784039b
#%patch0 -p1 -b .%{version}_dbafdc621bf4
279453f
16d1f70
%if 0%{?with_python3}
38e2496
rm -rf %{py3dir}
38e2496
cp -a . %{py3dir}
38e2496
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
16d1f70
%endif
38e2496
279453f
%build
279453f
%{__python} setup.py build
279453f
16d1f70
%if 0%{?with_python3}
38e2496
pushd %{py3dir}
38e2496
%{__python3} setup.py build
38e2496
popd
16d1f70
%endif
38e2496
38e2496
%check
16d1f70
%if 0%{?fedora}
38e2496
%{__python} setup.py check
38e2496
16d1f70
%if 0%{?with_python3}
38e2496
pushd %{py3dir}
38e2496
%{__python3} setup.py check
38e2496
popd
16d1f70
%endif
16d1f70
%endif
38e2496
279453f
%install
279453f
rm -rf $RPM_BUILD_ROOT
279453f
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
279453f
16d1f70
16d1f70
%if 0%{?with_python3}
38e2496
pushd %{py3dir}
38e2496
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
38e2496
popd
16d1f70
%endif
38e2496
279453f
%clean
279453f
rm -rf $RPM_BUILD_ROOT
279453f
279453f
%files
279453f
%defattr(-,root,root,-)
561737c
%doc LICENSE README.rst
279453f
%{python_sitelib}/*
279453f
16d1f70
%if 0%{?with_python3}
38e2496
%files -n python3-polib
38e2496
%defattr(-,root,root,-)
38e2496
%doc LICENSE README.rst
38e2496
%{python3_sitelib}/*
16d1f70
%endif
38e2496
279453f
%changelog
16d1f70
* Tue Jul 16 2013 Ding-Yi Chen <dchen@redhat.com> - 1.0.3-2
16d1f70
- Fix the build for EL6 and EL5 (without python3-polib)
16d1f70
12556cd
* Tue Jul 16 2013 Ding-Yi Chen <dchen@redhat.com> - 1.0.3-1
38e2496
- python3 binding is available (python3-polib)
c183f68
- Fixed Bug 978672 - This package should be updated.
12556cd
- Upstream update to 1.0.3
12556cd
- Version 1.0.3 (2013/02/09)
12556cd
  Fixed issue #38: POFile.append() raised a duplicate exception when you tried to add a new entry with the same msgid and a different msgctxt (only when check_for_duplicates option is set to True)
12556cd
  Fixed issue #39: Added __init__.py file for convenience
12556cd
  Fixed issue #41: UnicodeDecodeError when running setup.py build on python3 with C locale
12556cd
  polib is now fully PEP8 compliant
12556cd
  Small improvements: remove unused "typ" var (thanks Rodrigo Silva), mproved Makefile, Make sure _BaseFile.__contains__ returns a boolean value
12556cd
12556cd
- Version 1.0.2 (2012/10/23)
12556cd
  allow empty comments, flags or occurences lines
12556cd
12556cd
- Version 1.0.1 (2012/09/11)
12556cd
  speed up POFile.merge method (thanks @encukou)
12556cd
  allow comments starting with two '#' characters (thanks @goibhniu)
12556cd
7f2d874
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2
7f2d874
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
7f2d874
784039b
* Mon Jul 30 2012 Ding-Yi Chen <dchen@redhat.com> - 1.0.0-1
784039b
- Upstream update to 1.0.0
784039b
9b8e723
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.0-4
9b8e723
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
9b8e723
d34a590
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.0-3
d34a590
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
d34a590
2af1362
* Tue Nov 01 2011 Ding-Yi Chen <dchen@redhat.com> - 0.7.0-2
2af1362
- Update to upstream commit dbafdc621bf4, which include following:
2af1362
  * Add check for unescaped quotes at the beginning of the string + unit tests
2af1362
  * Fixed issue #27 (polib didn't check unescaped double quote) + better error handling
2af1362
  * Fixed typos in previous commit
2af1362
  * Fixed issue #26 IOError when parsing empty comments (thanks Türker Sezer)
2af1362
  * Do not hardcode polib version in doc conf
2af1362
561737c
* Fri Oct 28 2011 Ding-Yi Chen <dchen@redhat.com> - 0.7.0-1
561737c
- Correct URLs
561737c
- Replace README with README.rst
561737c
- Update to 0.7.0:
561737c
  From Version 0.7.0 (2011/07/14)
561737c
      This version adds support for python 3 (thanks to Vinay Sajip).
561737c
      polib now supports out-of-the-box any version of python ranging 
561737c
      from 2.4 to latest 3.X version.
561737c
  From Version 0.6.4 (2011/07/13)
561737c
      * Better api, autodetected_encoding is no longer required to 
561737c
        explicitely set the encoding (fixes issue #23),
561737c
      * Fixed issue #24 Support indented PO files (thanks to 
561737c
        François Poirotte).
561737c
  From Version 0.6.3 (2011/02/19)
561737c
      * Fixed issue #19 (Disappearing newline characters due to 
561737c
        textwrap module),
561737c
      * ensure wrapping works as expected.
561737c
  From Version 0.6.2 (2011/02/09)
561737c
      * Backported textwrap.TextWrapper._wrap_chunks that has support
561737c
        for the drop_whitespace parameter added in Python 2.6 (Fixes 
561737c
        #18: broken compatibility with python 2.5, thanks @jezdez).
561737c
  From Version 0.6.1 (2011/02/09)
561737c
      * fixed regression that prevented POFile initialization from 
561737c
        data to work (issue #17).
561737c
  From Version 0.6.0 (2011/02/07)
561737c
      * polib is now fully documented,
561737c
      * switched from doctests to unit tests to keep the polib.py 
561737c
        file clean,
561737c
      * fixed issue #7 (wrapping issues, thanks @jezdez),
561737c
      * added a __eq__ method to _BaseFile (thanks @kost BebiX),
561737c
      * handle msgctxt correctly when compiling mo files,
561737c
      * compiled mo files are now exactly the same as those compiled
561737c
        by msgfmt without using hash tables.
561737c
  From Version 0.5.5 (2010/10/30)
561737c
      * Removed multiline handling code, it was a mess and was the
561737c
        source of potential bugs like issue #11,
561737c
      * Fixed typo in README and CHANGELOG, fixes issue #13.
561737c
  From Version 0.5.4 (2010/10/02)
561737c
     * fixed an issue with detect_encoding(), in some cases it could
561737c
       return an invalid charset.
561737c
  From Version 0.5.3 (2010/08/29)
561737c
     * correctly unescape lines containing both \\n and \n 
561737c
      (thanks to Martin Geisler),
561737c
     * fixed issue #6: __str__() methods are returning unicode instead
561737c
       of str,
561737c
     * fixed issue #8: POFile.merge error when an entry is obsolete in
561737c
       a .po, that this entry reappears in the .pot and that we merge 
561737c
       the two,
561737c
     * added support to instanciate POFile objects using data instead 
561737c
       of file path (thanks to Diego Búrigo Zacarão),
561737c
     * fixed issue #9: POFile.merge drop fuzzy attributes from 
561737c
       translations (thanks to Tim Gerundt),
561737c
     * fixed issue #10: Finding entries with the same msgid and 
561737c
       different context (msgctxt).
561737c
  From Version 0.5.2 (2010/06/09)
561737c
     * fixed issue #1: untranslated_entries() also show fuzzy message,
561737c
     * write back the fuzzy header if present in the pofile,
561737c
     * added support for previous msgctxt, previous msgid and previous
561737c
       msgid_plural comments (fixes issue #5),
561737c
     * better handling of lines wrapping.
561737c
11a6350
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-3
11a6350
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
11a6350
cebb55c
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.5.1-2
cebb55c
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
cebb55c
143f524
* Mon Dec 14 2009 Diego Búrigo Zacarão <diegobz@gmail.com> - 0.5.1-1
143f524
- Updated to 0.5.1 release
143f524
86090d0
* Wed Aug 19 2009 Diego Búrigo Zacarão <diegobz@gmail.com> - 0.4.2-1
86090d0
- Updated to 0.4.2 release
86090d0
496560e
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0-2.20080217svnr60
496560e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
496560e
279453f
* Wed Feb 18 2009 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> 0.4.0-1.20080217svnr60
279453f
- Initial RPM release
279453f