Skip to content

Commit

Permalink
Remove items slated for removal in pip 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dstufft committed Sep 3, 2015
1 parent f4ba85e commit 6afc718
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 132 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
* **BACKWARD INCOMPATIBLE** Remove the ability to find any files other than the
ones directly linked from the index or find-links pages.

* **BACKWARD INCOMPATIBLE** Remove the ``--download-cache`` which had been
deprecated and no-op'd in 6.0.

* **BACKWARD INCOMPATIBLE** Remove the ``--log-explicit-levels`` which had been
deprecated in 6.0.

* Deprecate and no-op the ``--allow-external``, ``--allow-all-external``, and
``--allow-unverified`` functionality that was added as part of PEP 438. With
changes made to the repository protocol made in PEP 470, these options are no
Expand Down
15 changes: 1 addition & 14 deletions pip/basecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import sys
import optparse
import warnings

from pip import cmdoptions
from pip.locations import running_under_virtualenv
Expand All @@ -20,7 +19,6 @@
PREVIOUS_BUILD_DIR_ERROR,
)
from pip.utils import get_prog, normalize_path
from pip.utils.deprecation import RemovedInPip8Warning
from pip.utils.logging import IndentingFormatter
from pip.utils.outdated import pip_version_check

Expand Down Expand Up @@ -128,11 +126,7 @@ def main(self, args):
"formatters": {
"indent": {
"()": IndentingFormatter,
"format": (
"%(message)s"
if not options.log_explicit_levels
else "[%(levelname)s] %(message)s"
),
"format": "%(message)s",
},
},
"handlers": {
Expand Down Expand Up @@ -183,13 +177,6 @@ def main(self, args):
),
})

if options.log_explicit_levels:
warnings.warn(
"--log-explicit-levels has been deprecated and will be removed"
" in a future version.",
RemovedInPip8Warning,
)

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

Expand Down
17 changes: 0 additions & 17 deletions pip/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ def getname(n):
help="Path to a verbose appending log."
)

log_explicit_levels = partial(
Option,
# Writes the log levels explicitely to the log'
'--log-explicit-levels',
dest='log_explicit_levels',
action='store_true',
default=False,
help=SUPPRESS_HELP)

no_input = partial(
Option,
# Don't ask for input
Expand Down Expand Up @@ -461,13 +452,6 @@ def only_binary():
help="Disable the cache.",
)

download_cache = partial(
Option,
'--download-cache',
dest='download_cache',
default=None,
help=SUPPRESS_HELP)

no_deps = partial(
Option,
'--no-deps', '--no-dependencies',
Expand Down Expand Up @@ -545,7 +529,6 @@ def only_binary():
version,
quiet,
log,
log_explicit_levels,
no_input,
proxy,
retries,
Expand Down
11 changes: 1 addition & 10 deletions pip/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pip import cmdoptions
from pip.utils import ensure_dir
from pip.utils.build import BuildDirectory
from pip.utils.deprecation import RemovedInPip8Warning, RemovedInPip10Warning
from pip.utils.deprecation import RemovedInPip10Warning
from pip.utils.filesystem import check_path_owner
from pip.wheel import WheelCache, WheelBuilder

Expand Down Expand Up @@ -82,7 +82,6 @@ def __init__(self, *args, **kw):
"regardless of what's already installed."),
)

cmd_opts.add_option(cmdoptions.download_cache())
cmd_opts.add_option(cmdoptions.src())

cmd_opts.add_option(
Expand Down Expand Up @@ -255,14 +254,6 @@ def run(self, options, args):
logger.info('Ignoring indexes: %s', ','.join(index_urls))
index_urls = []

if options.download_cache:
warnings.warn(
"--download-cache has been deprecated and will be removed in "
"the future. Pip now automatically uses and configures its "
"cache.",
RemovedInPip8Warning,
)

with self._build_session(options) as session:

finder = self._build_package_finder(options, index_urls, session)
Expand Down
11 changes: 1 addition & 10 deletions pip/commands/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pip.req import RequirementSet
from pip.utils import import_or_raise, normalize_path
from pip.utils.build import BuildDirectory
from pip.utils.deprecation import RemovedInPip8Warning, RemovedInPip10Warning
from pip.utils.deprecation import RemovedInPip10Warning
from pip.wheel import WheelCache, WheelBuilder
from pip import cmdoptions

Expand Down Expand Up @@ -72,7 +72,6 @@ def __init__(self, *args, **kw):
cmd_opts.add_option(cmdoptions.constraints())
cmd_opts.add_option(cmdoptions.editable())
cmd_opts.add_option(cmdoptions.requirements())
cmd_opts.add_option(cmdoptions.download_cache())
cmd_opts.add_option(cmdoptions.src())
cmd_opts.add_option(cmdoptions.no_deps())
cmd_opts.add_option(cmdoptions.build_dir())
Expand Down Expand Up @@ -157,14 +156,6 @@ def run(self, options, args):
logger.info('Ignoring indexes: %s', ','.join(index_urls))
index_urls = []

if options.download_cache:
warnings.warn(
"--download-cache has been deprecated and will be removed in "
"the future. Pip now automatically uses and configures its "
"cache.",
RemovedInPip8Warning,
)

if options.build_dir:
options.build_dir = os.path.abspath(options.build_dir)

Expand Down
32 changes: 4 additions & 28 deletions pip/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pip.utils import (
Inf, cached_property, normalize_name, splitext, normalize_path,
ARCHIVE_EXTENSIONS, SUPPORTED_EXTENSIONS)
from pip.utils.deprecation import RemovedInPip8Warning
from pip.utils.deprecation import RemovedInPip9Warning
from pip.utils.logging import indent_log
from pip.exceptions import (
DistributionNotFound, BestVersionAlreadyInstalled, InvalidWheelFilename,
Expand Down Expand Up @@ -172,7 +172,7 @@ def add_dependency_links(self, links):
warnings.warn(
"Dependency Links processing has been deprecated and will be "
"removed in a future release.",
RemovedInPip8Warning,
RemovedInPip9Warning,
)
self.dependency_links.extend(links)

Expand Down Expand Up @@ -330,7 +330,7 @@ def _get_index_urls_locations(self, project_name):
"""

def mkurl_pypi_url(url):
loc = posixpath.join(url, project_url_name)
loc = posixpath.join(url, urllib_parse.quote(project_name.lower()))
# For maximum compatibility with easy_install, ensure the path
# ends in a trailing slash. Although this isn't in the spec
# (and PyPI can handle it without the slash) some other index
Expand All @@ -340,31 +340,7 @@ def mkurl_pypi_url(url):
loc = loc + '/'
return loc

project_url_name = urllib_parse.quote(project_name.lower())

if self.index_urls:
# Check that we have the url_name correctly spelled:

# Only check main index if index URL is given
main_index_url = Link(mkurl_pypi_url(self.index_urls[0]))

page = self._get_page(main_index_url)
if page is None and PyPI.netloc not in str(main_index_url):
warnings.warn(
"Failed to find %r at %s. It is suggested to upgrade "
"your index to support normalized names as the name in "
"/simple/{name}." % (project_name, main_index_url),
RemovedInPip8Warning,
)

project_url_name = self._find_url_name(
Link(self.index_urls[0]),
project_url_name,
) or project_url_name

if project_url_name is not None:
return [mkurl_pypi_url(url) for url in self.index_urls]
return []
return [mkurl_pypi_url(url) for url in self.index_urls]

def _find_all_versions(self, project_name):
"""Find all available versions for project_name
Expand Down
14 changes: 5 additions & 9 deletions pip/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import shutil
import sys
import tempfile
import warnings
import zipfile

from distutils.util import change_root
Expand All @@ -33,7 +32,6 @@
call_subprocess, read_text_file, FakeFile, _make_build_dir, ensure_dir,
get_installed_version
)
from pip.utils.deprecation import RemovedInPip8Warning
from pip.utils.logging import indent_log
from pip.req.req_uninstall import UninstallPathSet
from pip.vcs import vcs
Expand Down Expand Up @@ -637,14 +635,12 @@ def uninstall(self, auto_confirm=False):
paths_to_remove.add(path + '.pyc')

elif distutils_egg_info:
warnings.warn(
"Uninstalling a distutils installed project ({0}) has been "
"deprecated and will be removed in a future version. This is "
"due to the fact that uninstalling a distutils project will "
"only partially uninstall the project.".format(self.name),
RemovedInPip8Warning,
raise UninstallationError(
"Detected a distutils installed project ({0!r}) which we "
"cannot uninstall. The metadata provided by distutils does "
"not contain a list of files which have been installed, so "
"pip does not know which files to uninstall.".format(self.name)
)
paths_to_remove.add(distutils_egg_info)

elif dist.location.endswith('.egg'):
# package installed by easy_install
Expand Down
8 changes: 2 additions & 6 deletions pip/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ class PipDeprecationWarning(Warning):
pass


class RemovedInPip8Warning(PipDeprecationWarning, PendingDeprecationWarning):
pass


class RemovedInPip9Warning(PipDeprecationWarning, PendingDeprecationWarning):
class RemovedInPip9Warning(PipDeprecationWarning, DeprecationWarning):
pass


class RemovedInPip10Warning(PipDeprecationWarning, PendingDeprecationWarning):
pass


DEPRECATIONS = [RemovedInPip8Warning, RemovedInPip9Warning]
DEPRECATIONS = [RemovedInPip9Warning, RemovedInPip10Warning]


# Warnings <-> Logging Integration
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def test_url_req_case_mismatch_file_index(script, data):
set of packages as it requires a prepared index.html file and
subdirectory-per-package structure.
"""
Dinner = os.path.join(data.find_links3, 'Dinner', 'Dinner-1.0.tar.gz')
Dinner = os.path.join(data.find_links3, 'dinner', 'Dinner-1.0.tar.gz')
result = script.pip(
'install', '--index-url', data.find_links3, Dinner, 'requiredinner'
)
Expand Down
18 changes: 9 additions & 9 deletions tests/functional/test_install_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ def test_command_line_options_override_env_vars(script, virtualenv):
Test that command line options override environmental variables.
"""
script.environ['PIP_INDEX_URL'] = 'http://b.pypi.python.org/simple/'
script.environ['PIP_INDEX_URL'] = 'https://b.pypi.python.org/simple/'
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
assert (
"Getting page http://b.pypi.python.org/simple/initools"
"Getting page https://b.pypi.python.org/simple/initools"
in result.stdout
)
virtualenv.clear()
result = script.pip(
'install', '-vvv', '--index-url', 'http://download.zope.org/ppix',
'install', '-vvv', '--index-url', 'https://download.zope.org/ppix',
'INITools',
expect_error=True,
)
assert "b.pypi.python.org" not in result.stdout
assert "Getting page http://download.zope.org/ppix" in result.stdout
assert "Getting page https://download.zope.org/ppix" in result.stdout


@pytest.mark.network
Expand Down Expand Up @@ -150,23 +150,23 @@ def _test_config_file_override_stack(script, virtualenv, config_file):
script.environ['PIP_CONFIG_FILE'] = config_file
(script.scratch_path / config_file).write(textwrap.dedent("""\
[global]
index-url = http://download.zope.org/ppix
index-url = https://download.zope.org/ppix
"""))
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
assert (
"Getting page http://download.zope.org/ppix/initools" in result.stdout
"Getting page https://download.zope.org/ppix/initools" in result.stdout
)
virtualenv.clear()
(script.scratch_path / config_file).write(textwrap.dedent("""\
[global]
index-url = http://download.zope.org/ppix
index-url = https://download.zope.org/ppix
[install]
index-url = https://pypi.gocept.com/
"""))
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
assert "Getting page https://pypi.gocept.com/initools" in result.stdout
result = script.pip(
'install', '-vvv', '--index-url', 'http://pypi.python.org/simple',
'install', '-vvv', '--index-url', 'https://pypi.python.org/simple',
'INITools',
expect_error=True,
)
Expand All @@ -176,7 +176,7 @@ def _test_config_file_override_stack(script, virtualenv, config_file):
)
assert "Getting page https://pypi.gocept.com/INITools" not in result.stdout
assert (
"Getting page http://pypi.python.org/simple/initools" in result.stdout
"Getting page https://pypi.python.org/simple/initools" in result.stdout
)


Expand Down
22 changes: 0 additions & 22 deletions tests/functional/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,6 @@ def test_simple_uninstall(script):
assert_all_changes(result, result2, [script.venv / 'build', 'cache'])


def test_simple_uninstall_distutils(script):
"""
Test simple install and uninstall.
"""
script.scratch_path.join("distutils_install").mkdir()
pkg_path = script.scratch_path / 'distutils_install'
pkg_path.join("setup.py").write(textwrap.dedent("""
from distutils.core import setup
setup(
name='distutils-install',
version='0.1',
)
"""))
result = script.run('python', pkg_path / 'setup.py', 'install')
result = script.pip('list')
assert "distutils-install (0.1)" in result.stdout
script.pip('uninstall', 'distutils_install', '-y', expect_stderr=True)
result2 = script.pip('list')
assert "distutils-install (0.1)" not in result2.stdout


@pytest.mark.network
def test_uninstall_with_scripts(script):
"""
Expand Down
6 changes: 0 additions & 6 deletions tests/unit/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,6 @@ def test_log(self):
options2, args2 = main(['fake', '--log', 'path'])
assert options1.log == options2.log == 'path'

def test_log_explicit_levels(self):
options1, args1 = main(['--log-explicit-levels', 'fake'])
options2, args2 = main(['fake', '--log-explicit-levels'])
assert options1.log_explicit_levels
assert options2.log_explicit_levels

def test_local_log(self):
options1, args1 = main(['--local-log', 'path', 'fake'])
options2, args2 = main(['fake', '--local-log', 'path'])
Expand Down

0 comments on commit 6afc718

Please sign in to comment.