From 6b5414578371ed6816964cb2a82a4cf6fd5552ed Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Tue, 21 Mar 2017 07:28:22 -0400 Subject: [PATCH] Deprecate support for Python 3.3 --- news/3796.removal | 1 + pip/basecommand.py | 10 +++++++++- tests/functional/test_install.py | 2 +- tests/functional/test_install_upgrade.py | 25 ------------------------ tests/functional/test_uninstall.py | 4 ++-- tests/lib/__init__.py | 3 +++ 6 files changed, 16 insertions(+), 29 deletions(-) create mode 100644 news/3796.removal diff --git a/news/3796.removal b/news/3796.removal new file mode 100644 index 00000000000..6dcd44c99b5 --- /dev/null +++ b/news/3796.removal @@ -0,0 +1 @@ +Deprecate support for Python 3.3. diff --git a/pip/basecommand.py b/pip/basecommand.py index 1f63e075a63..49c1340712d 100644 --- a/pip/basecommand.py +++ b/pip/basecommand.py @@ -6,6 +6,7 @@ import os import sys import optparse +import warnings from pip import cmdoptions from pip.index import PackageFinder @@ -20,7 +21,7 @@ SUCCESS, ERROR, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND, PREVIOUS_BUILD_DIR_ERROR, ) -from pip.utils import get_prog, normalize_path +from pip.utils import deprecation, get_prog, normalize_path from pip.utils.logging import IndentingFormatter from pip.utils.outdated import pip_version_check @@ -185,6 +186,13 @@ def main(self, args): ), }) + if sys.version_info[:2] == (3, 3): + warnings.warn( + "Python 3.3 supported has been deprecated and support for it " + "will be dropped in the future. Please upgrade your Python.", + deprecation.RemovedInPip11Warning, + ) + # TODO: try to get these passing down from the command? # without resorting to os.environ to hold these. diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index e9e0e1d34a0..a0c09dcadce 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -70,7 +70,7 @@ def test_pip_second_command_line_interface_works(script, data): # On old versions of Python, urllib3/requests will raise a warning about # the lack of an SSLContext. kwargs = {} - if pyversion_tuple < (2, 7, 9): + if pyversion_tuple < (2, 7, 9) or pyversion_tuple[:2] == (3, 3): kwargs['expect_stderr'] = True args = ['pip%s' % pyversion] diff --git a/tests/functional/test_install_upgrade.py b/tests/functional/test_install_upgrade.py index 9faefa3fd92..db965f013e1 100644 --- a/tests/functional/test_install_upgrade.py +++ b/tests/functional/test_install_upgrade.py @@ -1,4 +1,3 @@ -import json import os import sys import textwrap @@ -449,27 +448,3 @@ def prep_ve(self, script, version, pip_src, distribute=False): cwd=pip_src, expect_stderr=True, ) - - @pytest.mark.skipif( - sys.version_info >= (3, 5), - reason="distribute doesn't work on Python 3.5", - ) - def test_from_distribute_6_to_setuptools_7( - self, script, data, virtualenv): - self.prep_ve( - script, '1.9.1', virtualenv.pip_source_dir, distribute=True - ) - result = self.script.run( - self.ve_bin / 'pip', 'install', '--no-index', - '--find-links=%s' % data.find_links, '-U', 'distribute', - ) - assert ( - "Found existing installation: distribute 0.6.34" in result.stdout - ) - result = self.script.run( - self.ve_bin / 'pip', 'list', '--format=json', - ) - assert {"name": "setuptools", "version": "0.9.8"} \ - in json.loads(result.stdout) - assert {"name": "distribute", "version": "0.7.3"} \ - in json.loads(result.stdout) diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index 41f6d81d5a8..12a36de6327 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -54,11 +54,11 @@ def test_simple_uninstall_distutils(script): in json.loads(result.stdout) result = script.pip('uninstall', 'distutils_install', '-y', expect_stderr=True, expect_error=True) - assert result.stderr.strip() == ( + assert ( "Cannot uninstall 'distutils-install'. It is a distutils installed " "project and thus we cannot accurately determine which files belong " "to it which would lead to only a partial uninstall." - ) + ) in result.stderr @pytest.mark.network diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index a4e9e816623..ff506412b89 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -334,6 +334,9 @@ def pip(self, *args, **kwargs): if (pyversion_tuple < (2, 7, 9) and args and args[0] in ('search', 'install', 'download')): kwargs['expect_stderr'] = True + # Python 3.3 is deprecated and we emit a warning on it. + if pyversion_tuple[:2] == (3, 3): + kwargs['expect_stderr'] = True return self.run("pip", *args, **kwargs)