Fix build with setuptools 58+, call /usr/bin/2to3 instead of setup(use_2to3=True)

This will break again in Python 3.12.
Hopefully, we will get rid of nose by then as upstream won't be able to use it.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2018972
f38
Miro Hrončok 3 years ago
parent 55d4b1e60b
commit dc14547839

@ -0,0 +1,53 @@
diff --git a/setup.py b/setup.py
index a2091c0..7e01bba 100644
--- a/setup.py
+++ b/setup.py
@@ -13,8 +13,7 @@ if sys.version_info >= (3,):
from distribute_setup import use_setuptools
use_setuptools()
- extra = {'use_2to3': True,
- 'test_dirs': test_dirs,
+ extra = {'test_dirs': test_dirs,
'test_build_dir': 'build/tests',
'pyversion_patching': True,
}
diff --git a/setup3lib.py b/setup3lib.py
index 27bdb93..761b74f 100644
--- a/setup3lib.py
+++ b/setup3lib.py
@@ -18,7 +18,6 @@ else:
import logging
from setuptools import Distribution as _Distribution
from distutils.core import Command
- from setuptools.command.build_py import Mixin2to3
from distutils import dir_util, file_util, log
import setuptools.command.test
from pkg_resources import normalize_path
@@ -68,7 +67,7 @@ else:
self.pyversion_patching = False
_Distribution.__init__(self, attrs)
- class BuildTestsCommand (Command, Mixin2to3):
+ class BuildTestsCommand (Command):
# Create mirror copy of tests, convert all .py files using 2to3
user_options = []
@@ -83,7 +82,6 @@ else:
self.test_base = test_base
def run(self):
- use_2to3 = getattr(self.distribution, 'use_2to3', False)
test_dirs = getattr(self.distribution, 'test_dirs', [])
test_base = self.test_base
bpy_cmd = self.get_finalized_command("build_py")
@@ -112,9 +110,6 @@ else:
if fn.endswith(ext):
doc_modified.append(dstfile)
break
- if use_2to3:
- self.run_2to3(py_modified)
- self.run_2to3(doc_modified, True)
if self.distribution.pyversion_patching:
if patch is not None:
for file in modified:

@ -2,7 +2,7 @@
Name: python-%{modname} Name: python-%{modname}
Version: 1.3.7 Version: 1.3.7
Release: 35%{?dist} Release: 36%{?dist}
BuildArch: noarch BuildArch: noarch
License: LGPLv2+ and Public Domain License: LGPLv2+ and Public Domain
@ -26,6 +26,10 @@ Patch3: python-nose-readunicode.patch
Patch4: python-nose-py36.patch Patch4: python-nose-py36.patch
# Remove a SyntaxWarning (other projects may treat it as error) # Remove a SyntaxWarning (other projects may treat it as error)
Patch5: python-nose-py38.patch Patch5: python-nose-py38.patch
# Remove use_2to3 from setuptools.setup() call
# We call the command line tool in %%prep instead
# https://fedoraproject.org/wiki/Changes/Setuptools_58+
Patch6: python-nose-no-use_2to3.patch
BuildRequires: dos2unix BuildRequires: dos2unix
@ -39,6 +43,7 @@ See https://fedoraproject.org/wiki/Changes/DeprecateNose}
%package -n python3-%{modname} %package -n python3-%{modname}
Summary: %{summary} Summary: %{summary}
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: /usr/bin/2to3
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: python3-coverage >= 3.4-1 BuildRequires: python3-coverage >= 3.4-1
Requires: python3-setuptools Requires: python3-setuptools
@ -58,6 +63,8 @@ Provides: deprecated()
dos2unix examples/attrib_plugin.py dos2unix examples/attrib_plugin.py
%build %build
2to3 %{?_smp_mflags} --write --nobackups --no-diffs .
2to3 %{?_smp_mflags} --write --nobackups --no-diffs -d $(find -name '*.rst')
%py3_build %py3_build
%install %install
@ -87,6 +94,10 @@ ln -sf nosetests-3.1 %{buildroot}%{_mandir}/man1/nosetests.1
%{python3_sitelib}/nose/ %{python3_sitelib}/nose/
%changelog %changelog
* Mon Nov 01 2021 Miro Hrončok <mhroncok@redhat.com> - 1.3.7-36
- Fix build with setuptools 58+
- Fixes rhbz#2018972
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.7-35 * Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.7-35
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

Loading…
Cancel
Save