Skip to content

Commit

Permalink
Merge pull request #5523 from pradyunsg/deprecations
Browse files Browse the repository at this point in the history
Remove items slated for removal in pip 11.0
  • Loading branch information
pradyunsg authored Jul 15, 2018
2 parents de899dd + 8032860 commit e6e0a14
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 235 deletions.
1 change: 1 addition & 0 deletions news/3651.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the legacy format from pip list
1 change: 1 addition & 0 deletions news/3654.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the legacy format from pip list
1 change: 1 addition & 0 deletions news/4174.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove support for cleaning up #egg fragment postfixes
43 changes: 2 additions & 41 deletions src/pip/_internal/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import json
import logging
import warnings

from pip._vendor import six
from pip._vendor.six.moves import zip_longest
Expand All @@ -11,7 +10,6 @@
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,
)
Expand Down Expand Up @@ -78,9 +76,9 @@ def __init__(self, *args, **kw):
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(
Expand Down Expand Up @@ -123,13 +121,6 @@ def _build_package_finder(self, options, index_urls, session):
)

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.")
Expand Down Expand Up @@ -208,30 +199,6 @@ def iter_packages_latest_infos(self, packages, options):
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,
Expand All @@ -249,12 +216,6 @@ def output_package_listing(self, packages, options):
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
Expand Down
4 changes: 2 additions & 2 deletions src/pip/_internal/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
)
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,
Expand Down Expand Up @@ -215,7 +215,7 @@ def add_dependency_links(self, links):
warnings.warn(
"Dependency Links processing has been deprecated and will be "
"removed in a future release.",
RemovedInPip11Warning,
RemovedInPip12Warning,
)
self.dependency_links.extend(links)

Expand Down
4 changes: 2 additions & 2 deletions src/pip/_internal/operations/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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,
)
Expand Down Expand Up @@ -219,7 +219,7 @@ def from_dist(cls, dist, dependency_links):
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:' %
Expand Down
22 changes: 2 additions & 20 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
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 (
Expand Down Expand Up @@ -1050,22 +1048,6 @@ def get_install_args(self, global_options, record_filename, root, prefix,
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
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 0 additions & 4 deletions src/pip/_internal/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ class Pending(object):
pass


class RemovedInPip11Warning(PipDeprecationWarning):
pass


class RemovedInPip12Warning(PipDeprecationWarning, Pending):
pass

Expand Down
Loading

0 comments on commit e6e0a14

Please sign in to comment.