Merge pull request #5523 from pradyunsg/deprecations

Remove items slated for removal in pip 11.0
This commit is contained in:
Pradyun Gedam 2018-07-15 16:57:57 +05:30 committed by GitHub
commit e6e0a14b68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 235 deletions

1
news/3651.removal Normal file
View File

@ -0,0 +1 @@
Remove the legacy format from pip list

1
news/3654.removal Normal file
View File

@ -0,0 +1 @@
Remove the legacy format from pip list

1
news/4174.removal Normal file
View File

@ -0,0 +1 @@
Remove support for cleaning up #egg fragment postfixes

View File

@ -2,7 +2,6 @@ from __future__ import absolute_import
import json
import logging
import warnings
from pip._vendor import six
from pip._vendor.six.moves import zip_longest
@ -11,7 +10,6 @@ from pip._internal.basecommand import Command
from pip._internal.cmdoptions import index_group, make_option_group
from pip._internal.exceptions import CommandError
from pip._internal.index import PackageFinder
from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip._internal.utils.misc import (
dist_is_editable, get_installed_distributions,
)
@ -78,9 +76,9 @@ class ListCommand(Command):
action='store',
dest='list_format',
default="columns",
choices=('legacy', 'columns', 'freeze', 'json'),
choices=('columns', 'freeze', 'json'),
help="Select the output format among: columns (default), freeze, "
"json, or legacy.",
"or json",
)
cmd_opts.add_option(
@ -123,13 +121,6 @@ class ListCommand(Command):
)
def run(self, options, args):
if options.list_format == "legacy":
warnings.warn(
"The legacy format has been deprecated and will be removed "
"in the future.",
RemovedInPip11Warning,
)
if options.outdated and options.uptodate:
raise CommandError(
"Options --outdated and --uptodate cannot be combined.")
@ -208,30 +199,6 @@ class ListCommand(Command):
dist.latest_filetype = typ
yield dist
def output_legacy(self, dist, options):
if options.verbose >= 1:
return '%s (%s, %s, %s)' % (
dist.project_name,
dist.version,
dist.location,
get_installer(dist),
)
elif dist_is_editable(dist):
return '%s (%s, %s)' % (
dist.project_name,
dist.version,
dist.location,
)
else:
return '%s (%s)' % (dist.project_name, dist.version)
def output_legacy_latest(self, dist, options):
return '%s - Latest: %s [%s]' % (
self.output_legacy(dist, options),
dist.latest_version,
dist.latest_filetype,
)
def output_package_listing(self, packages, options):
packages = sorted(
packages,
@ -249,12 +216,6 @@ class ListCommand(Command):
logger.info("%s==%s", dist.project_name, dist.version)
elif options.list_format == 'json':
logger.info(format_for_json(packages, options))
elif options.list_format == "legacy":
for dist in packages:
if options.outdated:
logger.info(self.output_legacy_latest(dist, options))
else:
logger.info(self.output_legacy(dist, options))
def output_package_listing_columns(self, data, header):
# insert the header first: we need to know the size of column names

View File

@ -29,7 +29,7 @@ from pip._internal.exceptions import (
)
from pip._internal.models.index import PyPI
from pip._internal.pep425tags import get_supported
from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip._internal.utils.deprecation import RemovedInPip12Warning
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
ARCHIVE_EXTENSIONS, SUPPORTED_EXTENSIONS, cached_property, normalize_path,
@ -215,7 +215,7 @@ class PackageFinder(object):
warnings.warn(
"Dependency Links processing has been deprecated and will be "
"removed in a future release.",
RemovedInPip11Warning,
RemovedInPip12Warning,
)
self.dependency_links.extend(links)

View File

@ -13,7 +13,7 @@ from pip._vendor.pkg_resources import RequirementParseError
from pip._internal.exceptions import InstallationError
from pip._internal.req import InstallRequirement
from pip._internal.req.req_file import COMMENT_RE
from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip._internal.utils.deprecation import RemovedInPip12Warning
from pip._internal.utils.misc import (
dist_is_editable, get_installed_distributions,
)
@ -219,7 +219,7 @@ class FrozenRequirement(object):
warnings.warn(
"SVN editable detection based on dependency links "
"will be dropped in the future.",
RemovedInPip11Warning,
RemovedInPip12Warning,
)
comments.append(
'# Installing as editable to satisfy requirement %s:' %

View File

@ -33,9 +33,7 @@ from pip._internal.locations import (
PIP_DELETE_MARKER_FILENAME, running_under_virtualenv,
)
from pip._internal.req.req_uninstall import UninstallPathSet
from pip._internal.utils.deprecation import (
RemovedInPip11Warning, RemovedInPip12Warning,
)
from pip._internal.utils.deprecation import RemovedInPip12Warning
from pip._internal.utils.hashes import Hashes
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
@ -1050,22 +1048,6 @@ class InstallRequirement(object):
return install_args
def _strip_postfix(req):
"""
Strip req postfix ( -dev, 0.2, etc )
"""
# FIXME: use package_to_requirement?
match = re.search(r'^(.*?)(?:-dev|-\d.*)$', req)
if match:
# Strip off -dev, -0.2, etc.
warnings.warn(
"#egg cleanup for editable urls will be dropped in the future",
RemovedInPip11Warning,
)
req = match.group(1)
return req
def parse_editable(editable_req):
"""Parses an editable requirement into:
- a requirement name
@ -1130,7 +1112,7 @@ def parse_editable(editable_req):
"Could not detect requirement name for '%s', please specify one "
"with #egg=your_package_name" % editable_req
)
return _strip_postfix(package_name), url, None
return package_name, url, None
def deduce_helpful_msg(req):

View File

@ -20,10 +20,6 @@ class Pending(object):
pass
class RemovedInPip11Warning(PipDeprecationWarning):
pass
class RemovedInPip12Warning(PipDeprecationWarning, Pending):
pass

View File

@ -51,19 +51,6 @@ def test_columns_flag(script, data):
assert 'simple2 3.0' in result.stdout, str(result)
def test_legacy_format(script, data):
"""
Test that legacy format
"""
script.pip(
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
'simple2==3.0',
)
result = script.pip('list', '--format=legacy', expect_stderr=True)
assert 'simple (1.0)' in result.stdout, str(result)
assert 'simple2 (3.0)' in result.stdout, str(result)
def test_format_priority(script, data):
"""
Test that latest format has priority over previous ones.
@ -72,18 +59,18 @@ def test_format_priority(script, data):
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
'simple2==3.0',
)
result = script.pip('list', '--format=columns', '--format=legacy',
result = script.pip('list', '--format=columns', '--format=freeze',
expect_stderr=True)
assert 'simple (1.0)' in result.stdout, str(result)
assert 'simple2 (3.0)' in result.stdout, str(result)
assert 'simple==1.0' in result.stdout, str(result)
assert 'simple2==3.0' in result.stdout, str(result)
assert 'simple 1.0' not in result.stdout, str(result)
assert 'simple2 3.0' not in result.stdout, str(result)
result = script.pip('list', '--format=legacy', '--format=columns')
result = script.pip('list', '--format=freeze', '--format=columns')
assert 'Package' in result.stdout, str(result)
assert 'Version' in result.stdout, str(result)
assert 'simple (1.0)' not in result.stdout, str(result)
assert 'simple2 (3.0)' not in result.stdout, str(result)
assert 'simple==1.0' not in result.stdout, str(result)
assert 'simple2==3.0' not in result.stdout, str(result)
assert 'simple 1.0' in result.stdout, str(result)
assert 'simple2 3.0' in result.stdout, str(result)
@ -111,17 +98,6 @@ def test_local_columns_flag(script, data):
assert 'simple 1.0' in result.stdout, str(result)
def test_local_legacy_flag(script, data):
"""
Test the behavior of --local --format=legacy flags in the list
command.
"""
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
result = script.pip('list', '--local', '--format=legacy',
expect_stderr=True)
assert 'simple (1.0)' in result.stdout
@pytest.mark.network
def test_user_flag(script, data, virtualenv):
"""
@ -157,23 +133,6 @@ def test_user_columns_flag(script, data, virtualenv):
assert 'simple2 2.0' in result.stdout, str(result)
@pytest.mark.network
def test_user_legacy(script, data, virtualenv):
"""
Test the behavior of --user flag in the list command
"""
virtualenv.system_site_packages = True
script.pip('download', 'setuptools', 'wheel', '-d', data.packages)
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
script.pip('install', '-f', data.find_links, '--no-index',
'--user', 'simple2==2.0')
result = script.pip('list', '--user', '--format=legacy',
expect_stderr=True)
assert 'simple (1.0)' not in result.stdout
assert 'simple2 (2.0)' in result.stdout, str(result)
@pytest.mark.network
def test_uptodate_flag(script, data):
"""
@ -225,30 +184,6 @@ def test_uptodate_columns_flag(script, data):
assert 'simple2 3.0' in result.stdout, str(result)
@pytest.mark.network
def test_uptodate_legacy_flag(script, data):
"""
Test the behavior of --uptodate --format=legacy flag in the list command
"""
script.pip(
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
'simple2==3.0',
)
script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
)
result = script.pip(
'list', '-f', data.find_links, '--no-index', '--uptodate',
'--format=legacy',
expect_stderr=True,
)
assert 'simple (1.0)' not in result.stdout # 3.0 is latest
assert 'pip-test-package (0.1.1,' in result.stdout # editables included
assert 'simple2 (3.0)' in result.stdout, str(result)
@pytest.mark.network
def test_outdated_flag(script, data):
"""
@ -314,33 +249,6 @@ def test_outdated_columns_flag(script, data):
assert 'simple2' not in result.stdout, str(result) # 3.0 is latest
@pytest.mark.network
def test_outdated_legacy(script, data):
"""
Test the behavior of --outdated --format=legacy flag in the list command
"""
script.pip(
'install', '-f', data.find_links, '--no-index', 'simple==1.0',
'simple2==3.0', 'simplewheel==1.0',
)
script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git'
'@0.1#egg=pip-test-package'
)
result = script.pip(
'list', '-f', data.find_links, '--no-index', '--outdated',
'--format=legacy',
expect_stderr=True,
)
assert 'simple (1.0) - Latest: 3.0 [sdist]' in result.stdout
assert 'simplewheel (1.0) - Latest: 2.0 [wheel]' in result.stdout
assert 'pip-test-package (0.1, ' in result.stdout
assert ' Latest: 0.1.1 [sdist]' in result.stdout
assert 'simple2' not in result.stdout, str(result) # 3.0 is latest
@pytest.mark.network
def test_editables_flag(script, data):
"""
@ -393,25 +301,6 @@ def test_editables_columns_flag(script, data):
)
@pytest.mark.network
def test_editables_legacy(script, data):
"""
Test the behavior of --editables flag in the list command
"""
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
)
result = script.pip(
'list', '--editable', '--format=legacy', expect_stderr=True,
)
assert 'simple (1.0)' not in result.stdout, str(result)
assert os.path.join('src', 'pip-test-package') in result.stdout, (
str(result)
)
@pytest.mark.network
def test_uptodate_editables_flag(script, data):
"""
@ -455,28 +344,6 @@ def test_uptodate_editables_columns_flag(script, data):
)
@pytest.mark.network
def test_uptodate_editables_legacy(script, data):
"""
test the behavior of --editable --uptodate --format=columns --format=legacy
flag in the list command
"""
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package'
)
result = script.pip(
'list', '-f', data.find_links, '--no-index', '--editable',
'--uptodate', '--format=legacy',
expect_stderr=True,
)
assert 'simple (1.0)' not in result.stdout, str(result)
assert os.path.join('src', 'pip-test-package') in result.stdout, (
str(result)
)
@pytest.mark.network
def test_outdated_editables_flag(script, data):
"""
@ -519,28 +386,6 @@ def test_outdated_editables_columns_flag(script, data):
)
@pytest.mark.network
def test_outdated_editables_legacy(script, data):
"""
test the behavior of --editable --outdated flag in the list command
"""
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
script.pip(
'install', '-e',
'git+https://github.com/pypa/pip-test-package.git'
'@0.1#egg=pip-test-package'
)
result = script.pip(
'list', '-f', data.find_links, '--no-index',
'--editable', '--outdated', '--format=legacy',
expect_stderr=True,
)
assert 'simple (1.0)' not in result.stdout, str(result)
assert os.path.join('src', 'pip-test-package') in result.stdout, (
str(result)
)
def test_outdated_pre(script, data):
script.pip('install', '-f', data.find_links, '--no-index', 'simple==1.0')
@ -583,11 +428,6 @@ def test_outdated_formats(script, data):
)
assert 'simple==1.0' in result.stdout
# Check legacy
result = script.pip('list', '--no-index', '--find-links', wheelhouse_path,
'--outdated', '--format=legacy', expect_stderr=True)
assert 'simple (1.0) - Latest: 1.1 [wheel]' in result.stdout
# Check columns
result = script.pip(
'list', '--no-index', '--find-links', wheelhouse_path,