Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Python 2.6 #4343

Merged
merged 16 commits into from
Mar 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ matrix:
- env: TOXENV=pep8
- env: TOXENV=py3pep8
- env: TOXENV=packaging
- python: 2.6 # these are just to make travis's UI a bit prettier

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to re-add the comment 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment isn't true anymore either. Later versions of Python need it in order to download the Python version on demand.

env: TOXENV=py26
- python: 2.7
env: TOXENV=py27
- python: 3.3
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
**9.1.0 (UNRELEASED)**
**10.0.0 (UNRELEASED)**

* **BACKWARD INCOMPATIBLE** Dropped support for Python 2.6.

* **WARNING** pip 9.1 cache format has changed. Old versions of pip cannot
read cache entries written by 9.1 but will handle this gracefully by
Expand Down
11 changes: 4 additions & 7 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ speed), although neither are required to install pre-built :term:`wheels
.. note::

The get-pip.py script is supported on the same python version as pip.
For the now unsupported Python 3.2, an alternate script is available
`here <https://bootstrap.pypa.io/3.2/get-pip.py>`__. For Python 2.6
which will be unsupported in pip 10.0, an alternative script is available
For the now unsupported Python 2.6, alternate script is available
`here <https://bootstrap.pypa.io/2.6/get-pip.py>`__.


Expand Down Expand Up @@ -110,11 +108,10 @@ On Windows [5]_:
Python and OS Compatibility
---------------------------

pip works with CPython versions 2.6, 2.7, 3.3, 3.4, 3.5 and also pypy.
pip works with CPython versions 2.7, 3.3, 3.4, 3.5, 3.6 and also pypy.

This means pip works on the latest patch version of each of these minor versions
(i.e. 2.6.9 for 2.6, etc).
Previous patch versions are supported on a best effort approach.
This means pip works on the latest patch version of each of these minor
versions. Previous patch versions are supported on a best effort approach.

pip works on Unix/Linux, macOS, and Windows.

Expand Down
2 changes: 1 addition & 1 deletion pip/_vendor/html5lib/filters/alphabeticalattributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from collections import OrderedDict
except ImportError:
from pip._vendor.ordereddict import OrderedDict
from ordereddict import OrderedDict

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If _vendor.orderdict has also been removed, should this be only the from collections line now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, this comes from html5lib and since we're no longer vendoring it then we leave the import alone.



class Filter(base.Filter):
Expand Down
2 changes: 1 addition & 1 deletion pip/_vendor/html5lib/html5parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
try:
from collections import OrderedDict
except ImportError:
from pip._vendor.ordereddict import OrderedDict
from ordereddict import OrderedDict

from . import _inputstream
from . import _tokenizer
Expand Down
2 changes: 1 addition & 1 deletion pip/_vendor/html5lib/treewalkers/etree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from collections import OrderedDict
except ImportError:
try:
from pip._vendor.ordereddict import OrderedDict
from ordereddict import OrderedDict
except ImportError:
OrderedDict = dict

Expand Down
127 changes: 0 additions & 127 deletions pip/_vendor/ordereddict.py

This file was deleted.

2 changes: 1 addition & 1 deletion pip/_vendor/pyparsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class names, and the use of '+', '|' and '^' operators.
from collections import OrderedDict as _OrderedDict
except ImportError:
try:
from pip._vendor.ordereddict import OrderedDict as _OrderedDict
from ordereddict import OrderedDict as _OrderedDict
except ImportError:
_OrderedDict = None

Expand Down
1 change: 0 additions & 1 deletion pip/_vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ colorama==0.3.7
CacheControl==0.12.1
msgpack-python==0.4.8
lockfile==0.12.2
ordereddict==1.1 # Only needed on 2.6
progress==1.2
ipaddress==1.0.18 # Only needed on 2.6 and 2.7
packaging==16.8
Expand Down
15 changes: 3 additions & 12 deletions pip/basecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from __future__ import absolute_import

import logging
import logging.config
import os
import sys
import optparse
import warnings

from pip import cmdoptions
from pip.index import PackageFinder
Expand All @@ -14,14 +14,13 @@
from pip.exceptions import (BadCommand, InstallationError, UninstallationError,
CommandError, PreviousBuildDirError)

from pip.compat import logging_dictConfig
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.req import InstallRequirement, parse_requirements
from pip.status_codes import (
SUCCESS, ERROR, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND,
PREVIOUS_BUILD_DIR_ERROR,
)
from pip.utils import deprecation, get_prog, normalize_path
from pip.utils import get_prog, normalize_path
from pip.utils.logging import IndentingFormatter
from pip.utils.outdated import pip_version_check

Expand Down Expand Up @@ -123,7 +122,7 @@ def main(self, args):
if options.log:
root_level = "DEBUG"

logging_dictConfig({
logging.config.dictConfig({
"version": 1,
"disable_existing_loggers": False,
"filters": {
Expand Down Expand Up @@ -186,14 +185,6 @@ def main(self, args):
),
})

if sys.version_info[:2] == (2, 6):
warnings.warn(
"Python 2.6 is no longer supported by the Python core team, "
"please upgrade your Python. A future version of pip will "
"drop support for Python 2.6",
deprecation.Python26DeprecationWarning
)

# TODO: try to get these passing down from the command?
# without resorting to os.environ to hold these.

Expand Down
2 changes: 1 addition & 1 deletion pip/commands/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def run(self, options, args):
options.abi,
options.implementation,
])
binary_only = FormatControl(set(), set([':all:']))
binary_only = FormatControl(set(), {':all:'})
if dist_restriction_set and options.format_control != binary_only:
raise CommandError(
"--only-binary=:all: must be set and --no-binary must not "
Expand Down
2 changes: 1 addition & 1 deletion pip/commands/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pip.wheel import WheelCache


DEV_PKGS = ('pip', 'setuptools', 'distribute', 'wheel')
DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'}


class FreezeCommand(Command):
Expand Down
3 changes: 2 additions & 1 deletion pip/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import sys
import textwrap

from collections import OrderedDict

from pip.basecommand import Command, SUCCESS
from pip.compat import OrderedDict
from pip.download import PipXmlrpcTransport
from pip.models import PyPI
from pip.utils import get_terminal_size
Expand Down
47 changes: 3 additions & 44 deletions pip/compat/__init__.py → pip/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@

from pip._vendor.six import text_type

try:
from logging.config import dictConfig as logging_dictConfig
except ImportError:
from pip.compat.dictconfig import dictConfig as logging_dictConfig

try:
from collections import OrderedDict
except ImportError:
from pip._vendor.ordereddict import OrderedDict

try:
import ipaddress
except ImportError:
Expand All @@ -28,30 +18,9 @@
ipaddress.ip_network = ipaddress.IPNetwork


try:
import sysconfig

def get_stdlib():
paths = [
sysconfig.get_path("stdlib"),
sysconfig.get_path("platstdlib"),
]
return set(filter(bool, paths))
except ImportError:
from distutils import sysconfig

def get_stdlib():
paths = [
sysconfig.get_python_lib(standard_lib=True),
sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
]
return set(filter(bool, paths))


__all__ = [
"logging_dictConfig", "ipaddress", "uses_pycache", "console_to_str",
"native_str", "get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile",
"OrderedDict",
"ipaddress", "uses_pycache", "console_to_str", "native_str",
"get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile",
]


Expand Down Expand Up @@ -90,14 +59,6 @@ def native_str(s, replace=False):
return s


def total_seconds(td):
if hasattr(td, "total_seconds"):
return td.total_seconds()
else:
val = td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6
return val / 10 ** 6


def get_path_uid(path):
"""
Return path's uid.
Expand Down Expand Up @@ -144,9 +105,7 @@ def expanduser(path):
# dist.location (py27:`sysconfig.get_paths()['stdlib']`,
# py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may
# make this ineffective, so hard-coding
stdlib_pkgs = ('python', 'wsgiref')
if sys.version_info >= (2, 7):
stdlib_pkgs += ('argparse',)
stdlib_pkgs = {"python", "wsgiref", "argparse"}


# windows detection, covers cpython and ironpython
Expand Down
Loading