diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-10 14:30:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-10 14:30:05 -0400 |
commit | d4fb0058d56bb03c97374665b62b6f0a1e586d49 (patch) | |
tree | b4f1494cdbcf10afbee28f84d10968e8cc8536d5 | |
parent | f4161185003af545562d88df99d609d30947ed2b (diff) | |
parent | a354d7bc1b7737fc1b4a9d238a247364035ab3d8 (diff) | |
download | external_python_setuptools-d4fb0058d56bb03c97374665b62b6f0a1e586d49.tar.gz external_python_setuptools-d4fb0058d56bb03c97374665b62b6f0a1e586d49.tar.bz2 external_python_setuptools-d4fb0058d56bb03c97374665b62b6f0a1e586d49.zip |
Merge pull request #2096 from pypa/feature/deprecate-2to3
Emit deprecation warning when 2to3 is used.
-rw-r--r-- | changelog.d/2086.change.rst | 1 | ||||
-rw-r--r-- | setuptools/lib2to3_ex.py | 9 | ||||
-rw-r--r-- | setuptools/tests/test_test.py | 6 |
3 files changed, 16 insertions, 0 deletions
diff --git a/changelog.d/2086.change.rst b/changelog.d/2086.change.rst new file mode 100644 index 00000000..9fa54e5a --- /dev/null +++ b/changelog.d/2086.change.rst @@ -0,0 +1 @@ +Deprecate 'use_2to3' functionality. Packagers are encouraged to use single-source solutions or build tool chains to manage conversions outside of setuptools. diff --git a/setuptools/lib2to3_ex.py b/setuptools/lib2to3_ex.py index 4b1a73fe..017f7285 100644 --- a/setuptools/lib2to3_ex.py +++ b/setuptools/lib2to3_ex.py @@ -7,11 +7,13 @@ Customized Mixin2to3 support: This module raises an ImportError on Python 2. """ +import warnings from distutils.util import Mixin2to3 as _Mixin2to3 from distutils import log from lib2to3.refactor import RefactoringTool, get_fixers_from_package import setuptools +from ._deprecation_warning import SetuptoolsDeprecationWarning class DistutilsRefactoringTool(RefactoringTool): @@ -33,6 +35,13 @@ class Mixin2to3(_Mixin2to3): return if not files: return + + warnings.warn( + "2to3 support is deprecated. If the project still " + "requires Python 2 support, please migrate to " + "a single-codebase solution or employ an " + "independent conversion process.", + SetuptoolsDeprecationWarning) log.info("Fixing " + " ".join(files)) self.__build_fixer_names() self.__exclude_fixers() diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 8ee70a7e..0f77d8ff 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -73,7 +73,11 @@ def quiet_log(): log.set_verbosity(0) +ack_2to3 = pytest.mark.filterwarnings('ignore:2to3 support is deprecated') + + @pytest.mark.usefixtures('sample_test', 'quiet_log') +@ack_2to3 def test_test(capfd): params = dict( name='foo', @@ -124,6 +128,7 @@ def test_tests_are_run_once(capfd): @pytest.mark.usefixtures('sample_test') +@ack_2to3 def test_warns_deprecation(capfd): params = dict( name='foo', @@ -149,6 +154,7 @@ def test_warns_deprecation(capfd): @pytest.mark.usefixtures('sample_test') +@ack_2to3 def test_deprecation_stderr(capfd): params = dict( name='foo', |