mirror of https://github.com/pypa/pip
Removed the deprecated ``--egg`` flag
This commit is contained in:
parent
10fc43889d
commit
bb48371714
|
@ -0,0 +1 @@
|
||||||
|
Removed the deprecated ``--egg`` parameter to ``pip install``.
|
|
@ -148,15 +148,6 @@ class InstallCommand(RequirementCommand):
|
||||||
cmd_opts.add_option(cmdoptions.install_options())
|
cmd_opts.add_option(cmdoptions.install_options())
|
||||||
cmd_opts.add_option(cmdoptions.global_options())
|
cmd_opts.add_option(cmdoptions.global_options())
|
||||||
|
|
||||||
cmd_opts.add_option(
|
|
||||||
'--egg',
|
|
||||||
dest='as_egg',
|
|
||||||
action='store_true',
|
|
||||||
help="Install packages as eggs, not 'flat', like pip normally "
|
|
||||||
"does. This option is not about installing *from* eggs. "
|
|
||||||
"(WARNING: Because this option overrides pip's normal install"
|
|
||||||
" logic, requirements files may not behave as expected.)")
|
|
||||||
|
|
||||||
cmd_opts.add_option(
|
cmd_opts.add_option(
|
||||||
"--compile",
|
"--compile",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
@ -192,15 +183,6 @@ class InstallCommand(RequirementCommand):
|
||||||
cmdoptions.resolve_wheel_no_use_binary(options)
|
cmdoptions.resolve_wheel_no_use_binary(options)
|
||||||
cmdoptions.check_install_build_global(options)
|
cmdoptions.check_install_build_global(options)
|
||||||
|
|
||||||
if options.as_egg:
|
|
||||||
warnings.warn(
|
|
||||||
"--egg has been deprecated and will be removed in the future. "
|
|
||||||
"This flag is mutually exclusive with large parts of pip, and "
|
|
||||||
"actually using it invalidates pip's ability to manage the "
|
|
||||||
"installation process.",
|
|
||||||
RemovedInPip10Warning,
|
|
||||||
)
|
|
||||||
|
|
||||||
if options.allow_external:
|
if options.allow_external:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"--allow-external has been deprecated and will be removed in "
|
"--allow-external has been deprecated and will be removed in "
|
||||||
|
@ -292,7 +274,6 @@ class InstallCommand(RequirementCommand):
|
||||||
download_dir=options.download_dir,
|
download_dir=options.download_dir,
|
||||||
upgrade=options.upgrade,
|
upgrade=options.upgrade,
|
||||||
upgrade_strategy=options.upgrade_strategy,
|
upgrade_strategy=options.upgrade_strategy,
|
||||||
as_egg=options.as_egg,
|
|
||||||
ignore_installed=options.ignore_installed,
|
ignore_installed=options.ignore_installed,
|
||||||
ignore_dependencies=options.ignore_dependencies,
|
ignore_dependencies=options.ignore_dependencies,
|
||||||
ignore_requires_python=options.ignore_requires_python,
|
ignore_requires_python=options.ignore_requires_python,
|
||||||
|
|
|
@ -70,9 +70,9 @@ def _strip_extras(path):
|
||||||
class InstallRequirement(object):
|
class InstallRequirement(object):
|
||||||
|
|
||||||
def __init__(self, req, comes_from, source_dir=None, editable=False,
|
def __init__(self, req, comes_from, source_dir=None, editable=False,
|
||||||
link=None, as_egg=False, update=True,
|
link=None, update=True, pycompile=True, markers=None,
|
||||||
pycompile=True, markers=None, isolated=False, options=None,
|
isolated=False, options=None, wheel_cache=None,
|
||||||
wheel_cache=None, constraint=False, extras=()):
|
constraint=False, extras=()):
|
||||||
assert req is None or isinstance(req, Requirement), req
|
assert req is None or isinstance(req, Requirement), req
|
||||||
self.req = req
|
self.req = req
|
||||||
self.comes_from = comes_from
|
self.comes_from = comes_from
|
||||||
|
@ -87,7 +87,6 @@ class InstallRequirement(object):
|
||||||
from pip.index import Link
|
from pip.index import Link
|
||||||
self.link = self.original_link = req and req.url and Link(req.url)
|
self.link = self.original_link = req and req.url and Link(req.url)
|
||||||
|
|
||||||
self.as_egg = as_egg
|
|
||||||
if extras:
|
if extras:
|
||||||
self.extras = extras
|
self.extras = extras
|
||||||
elif req:
|
elif req:
|
||||||
|
@ -757,10 +756,6 @@ class InstallRequirement(object):
|
||||||
logger.debug('Record file %s not found', record_filename)
|
logger.debug('Record file %s not found', record_filename)
|
||||||
return
|
return
|
||||||
self.install_succeeded = True
|
self.install_succeeded = True
|
||||||
if self.as_egg:
|
|
||||||
# there's no --always-unzip option we can pass to install
|
|
||||||
# command so we unable to save the installed-files.txt
|
|
||||||
return
|
|
||||||
|
|
||||||
def prepend_root(path):
|
def prepend_root(path):
|
||||||
if root is None or not os.path.isabs(path):
|
if root is None or not os.path.isabs(path):
|
||||||
|
@ -821,9 +816,7 @@ class InstallRequirement(object):
|
||||||
install_args.append(SETUPTOOLS_SHIM % self.setup_py)
|
install_args.append(SETUPTOOLS_SHIM % self.setup_py)
|
||||||
install_args += list(global_options) + \
|
install_args += list(global_options) + \
|
||||||
['install', '--record', record_filename]
|
['install', '--record', record_filename]
|
||||||
|
install_args += ['--single-version-externally-managed']
|
||||||
if not self.as_egg:
|
|
||||||
install_args += ['--single-version-externally-managed']
|
|
||||||
|
|
||||||
if root is not None:
|
if root is not None:
|
||||||
install_args += ['--root', root]
|
install_args += ['--root', root]
|
||||||
|
|
|
@ -142,7 +142,7 @@ class Installed(DistAbstraction):
|
||||||
class RequirementSet(object):
|
class RequirementSet(object):
|
||||||
|
|
||||||
def __init__(self, build_dir, src_dir, download_dir, upgrade=False,
|
def __init__(self, build_dir, src_dir, download_dir, upgrade=False,
|
||||||
upgrade_strategy=None, ignore_installed=False, as_egg=False,
|
upgrade_strategy=None, ignore_installed=False,
|
||||||
target_dir=None, ignore_dependencies=False,
|
target_dir=None, ignore_dependencies=False,
|
||||||
force_reinstall=False, use_user_site=False, session=None,
|
force_reinstall=False, use_user_site=False, session=None,
|
||||||
pycompile=True, isolated=False, wheel_download_dir=None,
|
pycompile=True, isolated=False, wheel_download_dir=None,
|
||||||
|
@ -186,7 +186,6 @@ class RequirementSet(object):
|
||||||
self.successfully_downloaded = []
|
self.successfully_downloaded = []
|
||||||
self.successfully_installed = []
|
self.successfully_installed = []
|
||||||
self.reqs_to_cleanup = []
|
self.reqs_to_cleanup = []
|
||||||
self.as_egg = as_egg
|
|
||||||
self.use_user_site = use_user_site
|
self.use_user_site = use_user_site
|
||||||
self.target_dir = target_dir # set from --target option
|
self.target_dir = target_dir # set from --target option
|
||||||
self.session = session
|
self.session = session
|
||||||
|
@ -246,7 +245,6 @@ class RequirementSet(object):
|
||||||
wheel.filename
|
wheel.filename
|
||||||
)
|
)
|
||||||
|
|
||||||
install_req.as_egg = self.as_egg
|
|
||||||
install_req.use_user_site = self.use_user_site
|
install_req.use_user_site = self.use_user_site
|
||||||
install_req.target_dir = self.target_dir
|
install_req.target_dir = self.target_dir
|
||||||
install_req.pycompile = self.pycompile
|
install_req.pycompile = self.pycompile
|
||||||
|
@ -360,11 +358,6 @@ class RequirementSet(object):
|
||||||
root_reqs = self.unnamed_requirements + self.requirements.values()
|
root_reqs = self.unnamed_requirements + self.requirements.values()
|
||||||
require_hashes = (self.require_hashes or
|
require_hashes = (self.require_hashes or
|
||||||
any(req.has_hash_options for req in root_reqs))
|
any(req.has_hash_options for req in root_reqs))
|
||||||
if require_hashes and self.as_egg:
|
|
||||||
raise InstallationError(
|
|
||||||
'--egg is not allowed with --require-hashes mode, since it '
|
|
||||||
'delegates dependency resolution to setuptools and could thus '
|
|
||||||
'result in installation of unhashed packages.')
|
|
||||||
|
|
||||||
# Actually prepare the files, and collect any exceptions. Most hash
|
# Actually prepare the files, and collect any exceptions. Most hash
|
||||||
# exceptions cannot be checked ahead of time, because
|
# exceptions cannot be checked ahead of time, because
|
||||||
|
|
|
@ -417,19 +417,6 @@ def test_upgrade_argparse_shadowed(script, data):
|
||||||
assert "Not uninstalling argparse" not in result.stdout
|
assert "Not uninstalling argparse" not in result.stdout
|
||||||
|
|
||||||
|
|
||||||
def test_install_as_egg(script, data):
|
|
||||||
"""
|
|
||||||
Test installing as egg, instead of flat install.
|
|
||||||
"""
|
|
||||||
to_install = data.packages.join("FSPkg")
|
|
||||||
result = script.pip('install', to_install, '--egg', expect_error=True)
|
|
||||||
fspkg_folder = script.site_packages / 'fspkg'
|
|
||||||
egg_folder = script.site_packages / 'FSPkg-0.1.dev0-py%s.egg' % pyversion
|
|
||||||
assert fspkg_folder not in result.files_created, str(result.stdout)
|
|
||||||
assert egg_folder in result.files_created, str(result)
|
|
||||||
assert join(egg_folder, 'fspkg') in result.files_created, str(result)
|
|
||||||
|
|
||||||
|
|
||||||
def test_install_curdir(script, data):
|
def test_install_curdir(script, data):
|
||||||
"""
|
"""
|
||||||
Test installing current directory ('.').
|
Test installing current directory ('.').
|
||||||
|
|
|
@ -359,29 +359,6 @@ def test_uninstall_from_reqs_file(script, tmpdir):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_uninstall_as_egg(script, data):
|
|
||||||
"""
|
|
||||||
Test uninstall package installed as egg.
|
|
||||||
"""
|
|
||||||
to_install = data.packages.join("FSPkg")
|
|
||||||
result = script.pip('install', to_install, '--egg', expect_error=True)
|
|
||||||
fspkg_folder = script.site_packages / 'fspkg'
|
|
||||||
egg_folder = script.site_packages / 'FSPkg-0.1.dev0-py%s.egg' % pyversion
|
|
||||||
assert fspkg_folder not in result.files_created, str(result.stdout)
|
|
||||||
assert egg_folder in result.files_created, str(result)
|
|
||||||
|
|
||||||
result2 = script.pip('uninstall', 'FSPkg', '-y')
|
|
||||||
assert_all_changes(
|
|
||||||
result,
|
|
||||||
result2,
|
|
||||||
[
|
|
||||||
script.venv / 'build',
|
|
||||||
'cache',
|
|
||||||
script.site_packages / 'easy-install.pth',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_uninstallpathset_no_paths(caplog):
|
def test_uninstallpathset_no_paths(caplog):
|
||||||
"""
|
"""
|
||||||
Test UninstallPathSet logs notification when there are no paths to
|
Test UninstallPathSet logs notification when there are no paths to
|
||||||
|
|
|
@ -277,18 +277,6 @@ class TestRequirementSet(object):
|
||||||
'3d0a6d4e8bfa6',
|
'3d0a6d4e8bfa6',
|
||||||
'file', 2)))
|
'file', 2)))
|
||||||
|
|
||||||
def test_no_egg_on_require_hashes(self, data):
|
|
||||||
"""Make sure --egg is illegal with --require-hashes.
|
|
||||||
|
|
||||||
--egg would cause dependencies to always be installed, since it cedes
|
|
||||||
control directly to setuptools.
|
|
||||||
|
|
||||||
"""
|
|
||||||
reqset = self.basic_reqset(require_hashes=True, as_egg=True)
|
|
||||||
finder = PackageFinder([data.find_links], [], session=PipSession())
|
|
||||||
with pytest.raises(InstallationError):
|
|
||||||
reqset.prepare_files(finder)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(('file_contents', 'expected'), [
|
@pytest.mark.parametrize(('file_contents', 'expected'), [
|
||||||
(b'\xf6\x80', b'\xc3\xb6\xe2\x82\xac'), # cp1252
|
(b'\xf6\x80', b'\xc3\xb6\xe2\x82\xac'), # cp1252
|
||||||
|
|
Loading…
Reference in New Issue