mirror of https://github.com/pypa/pip
Removed the deprecated --default-vcs option
This commit is contained in:
parent
f920a3de82
commit
ffac1c2180
|
@ -0,0 +1 @@
|
|||
Removed the deprecated ``--default-vcs`` option.
|
|
@ -272,7 +272,6 @@ class RequirementCommand(Command):
|
|||
requirement_set.add_requirement(
|
||||
InstallRequirement.from_editable(
|
||||
req,
|
||||
default_vcs=options.default_vcs,
|
||||
isolated=options.isolated_mode,
|
||||
wheel_cache=wheel_cache
|
||||
)
|
||||
|
|
|
@ -167,15 +167,6 @@ timeout = partial(
|
|||
default=15,
|
||||
help='Set the socket timeout (default %default seconds).')
|
||||
|
||||
default_vcs = partial(
|
||||
Option,
|
||||
# The default version control system for editables, e.g. 'svn'
|
||||
'--default-vcs',
|
||||
dest='default_vcs',
|
||||
type='str',
|
||||
default='',
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
skip_requirements_regex = partial(
|
||||
Option,
|
||||
# A regex to be used to skip requirements
|
||||
|
@ -531,7 +522,6 @@ general_group = {
|
|||
proxy,
|
||||
retries,
|
||||
timeout,
|
||||
default_vcs,
|
||||
skip_requirements_regex,
|
||||
exists_action,
|
||||
trusted_host,
|
||||
|
|
|
@ -18,7 +18,6 @@ logger = logging.getLogger(__name__)
|
|||
def freeze(
|
||||
requirement=None,
|
||||
find_links=None, local_only=None, user_only=None, skip_regex=None,
|
||||
default_vcs=None,
|
||||
isolated=False,
|
||||
wheel_cache=None,
|
||||
exclude_editable=False,
|
||||
|
@ -94,7 +93,6 @@ def freeze(
|
|||
line = line[len('--editable'):].strip().lstrip('=')
|
||||
line_req = InstallRequirement.from_editable(
|
||||
line,
|
||||
default_vcs=default_vcs,
|
||||
isolated=isolated,
|
||||
wheel_cache=wheel_cache,
|
||||
)
|
||||
|
|
|
@ -13,7 +13,6 @@ import optparse
|
|||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||
from pip._vendor.six.moves import filterfalse
|
||||
|
||||
import pip
|
||||
from pip.download import get_file_content
|
||||
from pip.req.req_install import InstallRequirement
|
||||
from pip.exceptions import (RequirementsFileParseError)
|
||||
|
@ -152,11 +151,9 @@ def process_line(line, filename, line_number, finder=None, comes_from=None,
|
|||
# yield an editable requirement
|
||||
elif opts.editables:
|
||||
isolated = options.isolated_mode if options else False
|
||||
default_vcs = options.default_vcs if options else None
|
||||
yield InstallRequirement.from_editable(
|
||||
opts.editables[0], comes_from=line_comes_from,
|
||||
constraint=constraint, default_vcs=default_vcs, isolated=isolated,
|
||||
wheel_cache=wheel_cache
|
||||
constraint=constraint, isolated=isolated, wheel_cache=wheel_cache
|
||||
)
|
||||
|
||||
# parse a nested requirements file
|
||||
|
|
|
@ -41,7 +41,7 @@ from pip.utils import (
|
|||
)
|
||||
|
||||
from pip.utils.hashes import Hashes
|
||||
from pip.utils.deprecation import RemovedInPip10Warning, RemovedInPip11Warning
|
||||
from pip.utils.deprecation import RemovedInPip11Warning
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.utils.setuptools_build import SETUPTOOLS_SHIM
|
||||
from pip.utils.ui import open_spinner
|
||||
|
@ -127,13 +127,11 @@ class InstallRequirement(object):
|
|||
self.isolated = isolated
|
||||
|
||||
@classmethod
|
||||
def from_editable(cls, editable_req, comes_from=None, default_vcs=None,
|
||||
isolated=False, options=None, wheel_cache=None,
|
||||
constraint=False):
|
||||
def from_editable(cls, editable_req, comes_from=None, isolated=False,
|
||||
options=None, wheel_cache=None, constraint=False):
|
||||
from pip.index import Link
|
||||
|
||||
name, url, extras_override = parse_editable(
|
||||
editable_req, default_vcs)
|
||||
name, url, extras_override = parse_editable(editable_req)
|
||||
if url.startswith('file:'):
|
||||
source_dir = url_to_path(url)
|
||||
else:
|
||||
|
@ -991,7 +989,7 @@ def _strip_postfix(req):
|
|||
return req
|
||||
|
||||
|
||||
def parse_editable(editable_req, default_vcs=None):
|
||||
def parse_editable(editable_req):
|
||||
"""Parses an editable requirement into:
|
||||
- a requirement name
|
||||
- an URL
|
||||
|
@ -1035,19 +1033,11 @@ def parse_editable(editable_req, default_vcs=None):
|
|||
break
|
||||
|
||||
if '+' not in url:
|
||||
if default_vcs:
|
||||
warnings.warn(
|
||||
"--default-vcs has been deprecated and will be removed in "
|
||||
"the future.",
|
||||
RemovedInPip10Warning,
|
||||
)
|
||||
url = default_vcs + '+' + url
|
||||
else:
|
||||
raise InstallationError(
|
||||
'%s should either be a path to a local project or a VCS url '
|
||||
'beginning with svn+, git+, hg+, or bzr+' %
|
||||
editable_req
|
||||
)
|
||||
raise InstallationError(
|
||||
'%s should either be a path to a local project or a VCS url '
|
||||
'beginning with svn+, git+, hg+, or bzr+' %
|
||||
editable_req
|
||||
)
|
||||
|
||||
vc_type = url.split('+', 1)[0].lower()
|
||||
|
||||
|
|
|
@ -235,11 +235,6 @@ class TestGeneralOptions(object):
|
|||
options2, args2 = main(['fake', '--timeout', '-1'])
|
||||
assert options1.timeout == options2.timeout == -1
|
||||
|
||||
def test_default_vcs(self):
|
||||
options1, args1 = main(['--default-vcs', 'path', 'fake'])
|
||||
options2, args2 = main(['fake', '--default-vcs', 'path'])
|
||||
assert options1.default_vcs == options2.default_vcs == 'path'
|
||||
|
||||
def test_skip_requirements_regex(self):
|
||||
options1, args1 = main(['--skip-requirements-regex', 'path', 'fake'])
|
||||
options2, args2 = main(['fake', '--skip-requirements-regex', 'path'])
|
||||
|
|
|
@ -559,23 +559,15 @@ def test_parse_editable_local(
|
|||
exists_mock.return_value = isdir_mock.return_value = True
|
||||
# mocks needed to support path operations on windows tests
|
||||
abspath_mock.return_value = "/some/path"
|
||||
assert parse_editable('.', 'git') == (None, 'file:///some/path', None)
|
||||
assert parse_editable('.') == (None, 'file:///some/path', None)
|
||||
abspath_mock.return_value = "/some/path/foo"
|
||||
assert parse_editable('foo', 'git') == (
|
||||
assert parse_editable('foo') == (
|
||||
None, 'file:///some/path/foo', None,
|
||||
)
|
||||
|
||||
|
||||
def test_parse_editable_default_vcs():
|
||||
assert parse_editable('https://foo#egg=foo', 'git') == (
|
||||
'foo',
|
||||
'git+https://foo#egg=foo',
|
||||
None,
|
||||
)
|
||||
|
||||
|
||||
def test_parse_editable_explicit_vcs():
|
||||
assert parse_editable('svn+https://foo#egg=foo', 'git') == (
|
||||
assert parse_editable('svn+https://foo#egg=foo') == (
|
||||
'foo',
|
||||
'svn+https://foo#egg=foo',
|
||||
None,
|
||||
|
@ -583,7 +575,7 @@ def test_parse_editable_explicit_vcs():
|
|||
|
||||
|
||||
def test_parse_editable_vcs_extras():
|
||||
assert parse_editable('svn+https://foo#egg=foo[extras]', 'git') == (
|
||||
assert parse_editable('svn+https://foo#egg=foo[extras]') == (
|
||||
'foo[extras]',
|
||||
'svn+https://foo#egg=foo[extras]',
|
||||
None,
|
||||
|
@ -597,11 +589,11 @@ def test_parse_editable_local_extras(
|
|||
isdir_mock, exists_mock, abspath_mock):
|
||||
exists_mock.return_value = isdir_mock.return_value = True
|
||||
abspath_mock.return_value = "/some/path"
|
||||
assert parse_editable('.[extras]', 'git') == (
|
||||
assert parse_editable('.[extras]') == (
|
||||
None, 'file://' + "/some/path", set(['extras']),
|
||||
)
|
||||
abspath_mock.return_value = "/some/path/foo"
|
||||
assert parse_editable('foo[bar,baz]', 'git') == (
|
||||
assert parse_editable('foo[bar,baz]') == (
|
||||
None, 'file:///some/path/foo', set(['bar', 'baz']),
|
||||
)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ def finder(session):
|
|||
@pytest.fixture
|
||||
def options(session):
|
||||
return stub(
|
||||
isolated_mode=False, default_vcs=None, index_url='default_url',
|
||||
isolated_mode=False, index_url='default_url',
|
||||
skip_requirements_regex=False,
|
||||
format_control=pip.index.FormatControl(set(), set()))
|
||||
|
||||
|
@ -281,14 +281,6 @@ class TestProcessLine(object):
|
|||
result = process_line(line, filename, 1, options=options)
|
||||
assert list(result)[0].isolated
|
||||
|
||||
def test_set_default_vcs(self, options):
|
||||
url = 'https://url#egg=SomeProject'
|
||||
line = '-e %s' % url
|
||||
filename = 'filename'
|
||||
options.default_vcs = 'git'
|
||||
result = process_line(line, filename, 1, options=options)
|
||||
assert list(result)[0].link.url == 'git+' + url
|
||||
|
||||
def test_set_finder_no_index(self, finder):
|
||||
list(process_line("--no-index", "file", 1, finder=finder))
|
||||
assert finder.index_urls == []
|
||||
|
|
Loading…
Reference in New Issue