-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python3-nose: translate to python3 code before build
Setuptools has removed support for 2to3 during builds since version 58[1]. But the nose's setup.py relies on use_2to3 option in setuptools, it is failing an import and building without running 2to3 and generating valid python3 code. As a workaround, we use command line 2to3 tool to translate to Python3 code before build it. Fixes: $ python3 >>> import nose Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.10/site-packages/nose/_init_.py", line 1, in <module> from nose.core import collector, main, run, run_exit, runmodule File "/usr/lib/python3.10/site-packages/nose/core.py", line 153 print "%s version %s" % (os.path.basename(sys.argv[0]), _version_) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? >>> [1] pypa/setuptools#2086 (From OE-Core rev: 11214c2de3282acb3a0fd28884d1a9c54c1c284a) Signed-off-by: Yi Zhao <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
meta/recipes-devtools/python/python3-nose/0001-Remove-use_2to3.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
From 4307868e31065c56456ddbf03325fc03643cd33f Mon Sep 17 00:00:00 2001 | ||
From: Yi Zhao <[email protected]> | ||
Date: Fri, 5 Nov 2021 10:12:16 +0800 | ||
Subject: [PATCH] Remove use_2to3 | ||
|
||
Since version 58, setuptools removed support for 2to3 during builds. | ||
|
||
Upstream-Status: Pending | ||
|
||
Signed-off-by: Yi Zhao <[email protected]> | ||
--- | ||
setup.py | 3 +-- | ||
setup3lib.py | 7 +------ | ||
2 files changed, 2 insertions(+), 8 deletions(-) | ||
|
||
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.17.1 | ||
|