#3 Enable py3 build on EL7
Opened 3 years ago by xavierb. Modified 2 years ago
rpms/ xavierb/python-parse epel7-py36  into  epel7

file modified
+2
@@ -1,2 +1,4 @@ 

  /parse-1.6.2.tar.gz

  /parse-1.6.4.tar.gz

+ /parse-1.6.6.tar.gz

+ /parse-1.8.4.tar.gz

@@ -1,53 +0,0 @@ 

- From c0368f526c3d84a149aed5fad179098138b06f66 Mon Sep 17 00:00:00 2001

- From: David King <amigadave@amigadave.com>

- Date: Mon, 14 Dec 2015 09:58:19 +0000

- Subject: [PATCH] Fix test_too_many_fields with Python 3.5

- 

- Python versions before 3.5 had a limit of 100 groups in regular

- expressions. This limit was removed during 3.5 development:

- 

- http://bugs.python.org/issue22437

- https://hg.python.org/cpython/rev/0b85ea4bd1af

- 

- The test_too_many_fields test asserts that the limit exists by

- attempting to parse a string with 15 fields, which triggers the 100

- named groups limit.

- 

- Adjust the test so that if first checks to see whether the limit of 100

- named groups exists, and only assert that parsing 15 fields fails if

- that is the case.

- ---

-  test_parse.py | 10 ++++++++--

-  1 file changed, 8 insertions(+), 2 deletions(-)

- 

- diff --git a/test_parse.py b/test_parse.py

- index c524349..1d50568 100755

- --- a/test_parse.py

- +++ b/test_parse.py

- @@ -6,6 +6,7 @@ See the end of the source file for the license of use.

- 

-  import unittest

-  from datetime import datetime, time

- +import re

- 

-  import parse

- 

- @@ -624,8 +625,13 @@ class TestParse(unittest.TestCase):

-          self.assertEqual(r.fixed[21], 'spam')

- 

-      def test_too_many_fields(self):

- -        p = parse.compile('{:ti}' * 15)

- -        self.assertRaises(parse.TooManyFields, p.parse, '')

- +        # Python 3.5 removed the limit of 100 named groups in a regular expression,

- +        # so only test for the exception if the limit exists.

- +        try:

- +            re.compile("".join("(?P<n{n}>{n}-)".format(n=i) for i in range(101)))

- +        except AssertionError:

- +            p = parse.compile('{:ti}' * 15)

- +            self.assertRaises(parse.TooManyFields, p.parse, '')

- 

- 

-  class TestSearch(unittest.TestCase):

- --

- 2.6.4

- 

file modified
+91 -75
@@ -1,110 +1,126 @@ 

  %global modname parse

  

- %if 0%{?rhel} > 7 || 0%{?fedora} >= 12

- %bcond_without python3

+ %if (%{defined rhel} && 0%{?rhel} < 8) || (%{defined fedora} && 0%{?fedora} < 30)

+ %bcond_without python2

  %else

- %bcond_with python3

- %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from %distutils.sysconfig import get_python_lib; print(get_python_lib())")}

+ %bcond_with    python2

  %endif

+ %bcond_without python3

  

- Name:               python-parse

- Version:            1.6.4

- Release:            4%{?dist}

- Summary:            Opposite of format()

- 

- Group:              Development/Libraries

- License:            BSD

- URL:                http://pypi.python.org/pypi/parse

- Source0:            http://pypi.python.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz

- # https://bugzilla.redhat.com/show_bug.cgi?id=1291218

- Patch0:             parse-python-3.5-test.patch

- 

- BuildArch:          noarch

- BuildRequires:      python2-devel

- BuildRequires:      python-setuptools

- %if %{with python3}

- BuildRequires:      python3-devel

- BuildRequires:      python3-setuptools

- %endif

+ Name:           python-%{modname}

+ Version:        1.8.4

+ Release:        2%{?dist}

+ Summary:        Opposite of format()

  

+ License:        BSD

+ URL:            http://pypi.python.org/pypi/parse

+ Source0:        %pypi_source %{modname}

  

- %description

- Parse strings using a specification based on the Python format() syntax.

+ BuildArch:      noarch

  

- ``parse()`` is the opposite of ``format()``

+ %global _description \

+ Parse strings using a specification based on the Python format() syntax.\

+ \

+ "parse()" is the opposite of "format()"

  

- %if %{with python3}

- %package -n python3-%{modname}

- Summary:        Opposite of format()

- Group:          Development/Libraries

+ %description %{_description}

  

- %description -n python3-%{modname}

- Parse strings using a specification based on the Python format() syntax.

+ %if %{with python2}

+ %package -n python2-%{modname}

+ Summary:        %{summary}

+ %{?python_provide:%python_provide python2-%{modname}}

+ BuildRequires:  python2-devel

+ BuildRequires:  python2-setuptools

  

- ``parse()`` is the opposite of ``format()``

+ %description -n python2-%{modname} %{_description}

  

- This package works with Python 3.

+ Python 2 version.

  %endif

  

+ %if %{with python3}

+ %package -n python%{python3_pkgversion}-%{modname}

+ Summary:        %{summary}

+ %{?python_provide:%python_provide python%{python3_pkgversion}-%{modname}}

+ BuildRequires:  python%{python3_pkgversion}-devel

+ BuildRequires:  python%{python3_pkgversion}-setuptools

  

- %prep

- %setup -q -n %{modname}-%{version}

- %patch0 -p1

- 

- # Remove bundled egg-info in case it exists

- rm -rf %{modname}.egg-info

+ %description -n python%{python3_pkgversion}-%{modname} %{_description}

  

- %if %{with python3}

- rm -rf %{py3dir}

- cp -a . %{py3dir}

- find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'

+ Python 3 version.

  %endif

  

+ %prep

+ %autosetup -n %{modname}-%{version} -p1

+ chmod -x README.rst

+ 

  %build

- %{__python} setup.py build

+ %{?with_python2:%py2_build}

+ %{?with_python3:%py3_build}

  

- %if %{with python3}

- pushd %{py3dir}

- %{__python3} setup.py build

- popd

- %endif

+ %install

+ %{?with_python2:%py2_install}

+ %{?with_python3:%py3_install}

  

+ %check

+ %{?with_python2:%{__python2} test_parse.py}

+ %{?with python3:%{__python3} test_parse.py}

+ 

+ %if %{with python2}

+ %files -n python2-%{modname}

+ %doc README.rst

+ %{python2_sitelib}/%{modname}-%{version}-*.egg-info

+ %{python2_sitelib}/%{modname}.py*

+ %endif

  

- %install

- # Must do the python3 install first because the scripts in /usr/bin are

- # overwritten with every setup.py install (and we want the python2

- # version to be the default for now).

  %if %{with python3}

- pushd %{py3dir}

- %{__python3} setup.py install --skip-build --root=%{buildroot}

- popd

+ %files -n python%{python3_pkgversion}-%{modname}

+ %doc README.rst

+ %{python3_sitelib}/%{modname}-%{version}-*.egg-info

+ %{python3_sitelib}/%{modname}.py

+ %{python3_sitelib}/__pycache__/%{modname}.*

  %endif

  

- %{__python} setup.py install -O1 --skip-build --root=%{buildroot}

+ %changelog

+ * Mon Jan 07 2019 Xavier Bachelot <xavier@bachelot.org> - 1.8.4-2

+ - Enable python3 build for EL7.

  

+ * Mon Jul 30 2018 Miro Hrončok <mhroncok@redhat.com> - 1.8.4-1

+ - Update to 1.8.4

  

- %check

- %{__python} test_parse.py

+ * Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.6-10

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

  

- %if %{with python3}

- pushd %{py3dir}

- %{__python3} test_parse.py

- popd

- %endif

+ * Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.6.6-9

+ - Rebuilt for Python 3.7

  

- %files

- %doc README.rst

- %{python_sitelib}/%{modname}*

+ * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.6-8

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

  

- %if %{with python3}

- %files -n python3-%{modname}

- %doc README.rst

- %{python3_sitelib}/%{modname}*

- %{python3_sitelib}/__pycache__/%{modname}*

- %endif

+ * Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.6-7

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

  

+ * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.6-6

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

+ 

+ * Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.6.6-5

+ - Rebuild for Python 3.6

+ 

+ * Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.6-4

+ - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

+ 

+ * Tue Apr 19 2016 Igor Gnatenko <ignatenko@redhat.com> - 1.6.6-3

+ - Remove unneded BuildRequires

+ - Use %%python_provde

+ - Correctly split to python2- subpkg

+ - Fix spurious-executable-perm

+ - Don't use %%py3dir

+ 

+ * Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.6-2

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

+ 

+ * Tue Dec 15 2015 Matěj Cepl <mcepl@redhat.com> - 1.6.6-1

+ - Upgrade to the latest upstream (#1291602)

  

- %changelog

  * Mon Dec 14 2015 David King <amigadave@amigadave.com> - 1.6.4-4

  - Fix test failure with Python 3.5 (#1291218)

  

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- 87bfd55c25d1aea2d7499197254f3a6f  parse-1.6.4.tar.gz

+ SHA512 (parse-1.8.4.tar.gz) = 8031d422cc5fb8519ee9bf6f29bfb0891a24b7ac2b9823fcfa14703682464d2d5b7b3377581358c46595677990665a348d6875ed079a737b7d7477cf1add80e6

no initial comment

Are you sure that the proposed changes are backward compatible? If they are not, there is a special policy for incompatible updates in epel. Unfortunately, upstream does not use tags so it's not easy to compare the versions.