%if ( 0%{?fedora} && 0%{?fedora} <= 30 ) || ( 0%{?rhel} && 0%{?rhel} <= 7 ) %global with_python2 1 %endif %if ( 0%{?fedora} && 0%{?fedora} >= 13 ) || ( 0%{?rhel} && 0%{?rhel} >= 7 ) %global with_python3 1 %endif %define supports_recommends %{nil} %if 0%{?rhel}%{?fedora} %if 0%{?rhel} >= 8 %define supports_recommends 1 %else %if 0%{?fedora} >= 24 %define supports_recommends 1 %endif %endif %else %if 0%{?suse_version} %if 0%{?suse_version} >= 1000 %define supports_recommends 1 %endif %endif %endif Name: odfpy Version: 1.4.1 Release: 1%{?dist} Summary: Python library for manipulating OpenDocument files License: GPLv2+ URL: https://github.com/eea/odfpy Source0: https://github.com/eea/%{name}/archive/release-%{version}.tar.gz#/%{name}-%{version}.tar.gz Patch0: odfpy-allow-py38-testing.patch BuildArch: noarch # https://github.com/eea/odfpy/tree/release-1.4.1#running-tests #BuildRequires: python-tox #Provides: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: %{name} < %{?epoch:%{epoch}:}%{version}-%{release} %if %{with python2} %if ! %{with python3} || ( 0%{?rhel} && 0%{?rhel} <= 7 ) || ( 0%{?fedora} && 0%{?fedora} <= 26 ) Requires: python2-%{name} Obsoletes: python-%{name} < %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: python2-%{name} < %{?epoch:%{epoch}:}%{version}-%{release} %endif %endif %if %{with python3} Requires: python3-%{name} Obsoletes: python3-%{name} < %{?epoch:%{epoch}:}%{version}-%{release} %if 0%{?rhel} && 0%{?rhel} <= 7 Obsoletes: python34-%{name} < %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: python36-%{name} < %{?epoch:%{epoch}:}%{version}-%{release} %endif %endif %description Odfpy aims to be a complete API for OpenDocument in Python. Unlike other more convenient APIs, this one is essentially an abstraction layer just above the XML format. The main focus has been to prevent the programmer from creating invalid documents. It has checks that raise an exception if the programmer adds an invalid element, adds an attribute unknown to the grammar, forgets to add a required attribute or adds text to an element that doesn't allow it. These checks and the API itself were generated from the RelaxNG schema, and then hand-edited. Therefore the API is complete and can handle all ODF constructions, but could be improved in its understanding of data types. %if %{with python2} %package -n python2-%{name} Summary: %{summary} BuildRequires: python2-devel BuildRequires: python2-setuptools BuildRequires: python2-pytest BuildRequires: python2-defusedxml %if 0%{?supports_recommends} Recommends: odfpy %endif Provides: python-%{name} = %{?epoch:%{epoch}:}%{version}-%{release} %{?python_provide:%python_provide python2-%{name}} %description -n python2-%{name} Odfpy aims to be a complete API for OpenDocument in Python. Unlike other more convenient APIs, this one is essentially an abstraction layer just above the XML format. The main focus has been to prevent the programmer from creating invalid documents. It has checks that raise an exception if the programmer adds an invalid element, adds an attribute unknown to the grammar, forgets to add a required attribute or adds text to an element that doesn't allow it. These checks and the API itself were generated from the RelaxNG schema, and then hand-edited. Therefore the API is complete and can handle all ODF constructions, but could be improved in its understanding of data types. This package provides Python 2 build of %{name}. %endif %if %{with python3} %package -n python3-%{name} Summary: %{summary} BuildRequires: python3-devel BuildRequires: python3-setuptools %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: python36-pytest BuildRequires: python36-defusedxml %else BuildRequires: python3-pytest BuildRequires: python3-defusedxml %endif %if 0%{?supports_recommends} Recommends: odfpy %endif %if 0%{?rhel} && 0%{?rhel} <= 7 Provides: python36-%{name} = %{?epoch:%{epoch}:}%{version}-%{release} %endif %{?python_provide:%python_provide python3-%{name}} %description -n python3-%{name} Odfpy aims to be a complete API for OpenDocument in Python. Unlike other more convenient APIs, this one is essentially an abstraction layer just above the XML format. The main focus has been to prevent the programmer from creating invalid documents. It has checks that raise an exception if the programmer adds an invalid element, adds an attribute unknown to the grammar, forgets to add a required attribute or adds text to an element that doesn't allow it. These checks and the API itself were generated from the RelaxNG schema, and then hand-edited. Therefore the API is complete and can handle all ODF constructions, but could be improved in its understanding of data types. This package provides Python 3 build of %{name}. %endif %package doc Summary: %{summary} %description doc Odfpy aims to be a complete API for OpenDocument in Python. Unlike other more convenient APIs, this one is essentially an abstraction layer just above the XML format. The main focus has been to prevent the programmer from creating invalid documents. It has checks that raise an exception if the programmer adds an invalid element, adds an attribute unknown to the grammar, forgets to add a required attribute or adds text to an element that doesn't allow it. These checks and the API itself were generated from the RelaxNG schema, and then hand-edited. Therefore the API is complete and can handle all ODF constructions, but could be improved in its understanding of data types. This package provides documentation of %{name}. %prep %autosetup -n %{name}-release-%{version} %if %{with python3} # Change shebang in all relevant files find -type f -exec sed -i '1s=^#!/usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} + %else find -type f -exec sed -i '1s=^#!/usr/bin/\(python\|env python\)[23]\?=#!%{__python2}=' {} + %endif %build %if %{with python2} %py2_build %endif %if %{with python3} %py3_build %endif %install %if %{with python2} %py2_install %if %{with python3} %{__rm} %{buildroot}%{_bindir}/* %{__rm} %{buildroot}%{_mandir}/man1/* %endif %endif %if %{with python3} %py3_install %endif %check # pytest < 3.0.0 can't handle built-in setup.cfg %if ( 0%{?fedora} && 0%{?fedora} <= 25 ) || ( 0%{?rhel} && 0%{?rhel} <= 7 ) %{__cat} << EOF > pytest.ini [pytest] norecursedirs = grammar addopts = tests python_files = test*.py EOF %endif %if %{with python2} %{__python2} -m pytest --verbose %endif %if %{with python3} %{__python3} -m pytest --verbose %endif %files %license GPL-LICENSE-2.txt APACHE-LICENSE-2.0.txt %{_bindir}/* %{_mandir}/man1/* %if %{with python2} %files -n python2-%{name} %license GPL-LICENSE-2.txt APACHE-LICENSE-2.0.txt %{python2_sitelib}/*egg-info %{python2_sitelib}/odf %endif %if %{with python3} %files -n python3-%{name} %license GPL-LICENSE-2.txt APACHE-LICENSE-2.0.txt %{python3_sitelib}/*egg-info %{python3_sitelib}/odf %endif %files doc %license GPL-LICENSE-2.txt APACHE-LICENSE-2.0.txt %doc doc examples contrib %changelog * Thu Jan 23 2020 Tomasz Tomasik - 1.4.1-1 - Update to 1.4.1 * Wed Jan 22 2020 Tomasz Tomasik - 1.4.0-2.1 - Rebuilt for EL7 * Thu Oct 03 2019 Miro Hrončok - 1.4.0-2 - Rebuilt for Python 3.8.0rc1 (#1748018) * Fri Aug 30 2019 Paul W. Frields - 1.4.0-1 - New upstream release 1.4.0 * Fri Aug 30 2019 Miro Hrončok - 1.3.4-10 - Subpackage python2-odfpy has been removed See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal * Mon Aug 19 2019 Miro Hrončok - 1.3.4-9 - Rebuilt for Python 3.8 * Thu Jul 25 2019 Fedora Release Engineering - 1.3.4-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Fri Feb 01 2019 Fedora Release Engineering - 1.3.4-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Fri Jul 13 2018 Fedora Release Engineering - 1.3.4-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Tue Jun 19 2018 Miro Hrončok - 1.3.4-5 - Rebuilt for Python 3.7 * Thu Feb 08 2018 Fedora Release Engineering - 1.3.4-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 1.3.4-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Mon Mar 13 2017 Charalampos Stratakis 1.3.4-2 - Add proper provides and obsoletes for a clean upgrade path after renaming the python2 subpackage * Fri Mar 3 2017 Iryna Shcherbina 1.3.4-1 - Update to 1.3.4, run tests * Fri Mar 3 2017 Jan Beran 1.3.3-1 - New version including Python 3 subpackage * Sat Feb 11 2017 Fedora Release Engineering - 0.9.6-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Tue Jul 19 2016 Fedora Release Engineering - 0.9.6-5 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages * Thu Feb 04 2016 Fedora Release Engineering - 0.9.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Wed Jun 17 2015 Fedora Release Engineering - 0.9.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Sat Jun 07 2014 Fedora Release Engineering - 0.9.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Fri Apr 25 2014 Kevin Fenzi 0.9.6-1 - Update to 0.9.6 Fixes calibre bug #989538 * Sat Aug 03 2013 Fedora Release Engineering - 0.9.2-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Wed Jun 12 2013 Peter Robinson 0.9.2-7 - Fix FTBFS * Thu Feb 14 2013 Fedora Release Engineering - 0.9.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Fri Jul 20 2012 Fedora Release Engineering - 0.9.2-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Fri Jan 13 2012 Fedora Release Engineering - 0.9.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Tue Feb 08 2011 Fedora Release Engineering - 0.9.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Fri Jul 30 2010 Ian Weller - 0.9.2-2 - Fixed previous changelog entry * Fri Jul 30 2010 Ian Weller - 0.9.2-1 - Update to 0.9.2 * Wed Jul 21 2010 David Malcolm - 0.9-3 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild * Sat Jul 25 2009 Fedora Release Engineering - 0.9-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild * Mon Apr 20 2009 Ian Weller - 0.9-1 - Update upstream * Thu Feb 26 2009 Fedora Release Engineering - 0.8-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild * Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.8-2 - Rebuild for Python 2.6 * Fri Aug 22 2008 Ian Weller 0.8-1 - Update upstream * Tue Jul 15 2008 Ian Weller 0.7-2 - Change macros - Remove license file * Sun Jul 13 2008 Ian Weller 0.7-1 - Add COPYING file - Use setuptools instead - sed out shebangs from module files - Other minor fixes * Sun Jul 13 2008 Paul W. Frields - 0.7-0.1 - Initial RPM package