Finish removing invocations of pip.
We don't depend on recursive installations via pip - and pip certainly doesn't support that. We removed part of it recently, finish removing it all. Change-Id: I29bc4070b355e52124ceae459ea20403d134b60a
This commit is contained in:
parent
44ee5f0d0c
commit
d67f22fc3f
|
@ -42,17 +42,19 @@ versions as versions of the release before.
|
||||||
Dependencies
|
Dependencies
|
||||||
============
|
============
|
||||||
|
|
||||||
`pbr` overrides almost everything having to do with python dependency
|
As of 1.0.0 `pbr` doesn't alter the dependency behaviour of `setuptools`.
|
||||||
resolution and calls out to `pip`. In the python source package world this
|
|
||||||
leads to a more consistent experience. However, in the distro packaging world,
|
|
||||||
dependencies are handled by the distro. Setting `SKIP_PIP_INSTALL`:
|
|
||||||
|
|
||||||
::
|
Older versions would invoke `pip` internally under some circumstances and
|
||||||
|
required the environment variable `SKIP_PIP_INSTALL` to be set to prevent
|
||||||
|
that. Since 1.0.0 we now document that dependencies should be installed before
|
||||||
|
installing a `pbr` using package. We don't support easy install, but neither
|
||||||
|
do we interfere with it today. If you observe easy install being triggered when
|
||||||
|
building a binary package, then you've probably missed one or more package
|
||||||
|
requirements.
|
||||||
|
|
||||||
SKIP_PIP_INSTALL=1
|
Note: we reserve the right to disable easy install via `pbr` in future, since
|
||||||
|
we don't want to debug or support the interactions that can occur when using
|
||||||
will cause all logic around use of `pip` to be skipped, including the logic
|
it.
|
||||||
that includes pip as a dependency of `pbr` itself.
|
|
||||||
|
|
||||||
Tarballs
|
Tarballs
|
||||||
========
|
========
|
||||||
|
|
|
@ -68,23 +68,6 @@ def append_text_list(config, key, text_list):
|
||||||
config[key] = '\n'.join(new_value)
|
config[key] = '\n'.join(new_value)
|
||||||
|
|
||||||
|
|
||||||
def _pip_install(links, requires, root=None, option_dict=dict()):
|
|
||||||
if options.get_boolean_option(
|
|
||||||
option_dict, 'skip_pip_install', 'SKIP_PIP_INSTALL'):
|
|
||||||
return
|
|
||||||
cmd = [sys.executable, '-m', 'pip.__init__', 'install']
|
|
||||||
if root:
|
|
||||||
cmd.append("--root=%s" % root)
|
|
||||||
for link in links:
|
|
||||||
cmd.append("-f")
|
|
||||||
cmd.append(link)
|
|
||||||
|
|
||||||
# NOTE(ociuhandu): popen on Windows does not accept unicode strings
|
|
||||||
git._run_shell_command(
|
|
||||||
cmd + requires,
|
|
||||||
throw_on_error=True, buffer=False, env=dict(PIP_USE_WHEEL=b"true"))
|
|
||||||
|
|
||||||
|
|
||||||
def _any_existing(file_list):
|
def _any_existing(file_list):
|
||||||
return [f for f in file_list if os.path.exists(f)]
|
return [f for f in file_list if os.path.exists(f)]
|
||||||
|
|
||||||
|
@ -187,53 +170,10 @@ class LocalInstall(install.install):
|
||||||
return du_install.install.run(self)
|
return du_install.install.run(self)
|
||||||
|
|
||||||
|
|
||||||
def _newer_requires_files(egg_info_dir):
|
|
||||||
"""Check to see if any of the requires files are newer than egg-info."""
|
|
||||||
for target, sources in (('requires.txt', get_requirements_files()),
|
|
||||||
('test-requires.txt', TEST_REQUIREMENTS_FILES)):
|
|
||||||
target_path = os.path.join(egg_info_dir, target)
|
|
||||||
for src in _any_existing(sources):
|
|
||||||
if (not os.path.exists(target_path) or
|
|
||||||
os.path.getmtime(target_path)
|
|
||||||
< os.path.getmtime(src)):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def _copy_test_requires_to(egg_info_dir):
|
|
||||||
"""Copy the requirements file to egg-info/test-requires.txt."""
|
|
||||||
with open(os.path.join(egg_info_dir, 'test-requires.txt'), 'w') as dest:
|
|
||||||
for source in _any_existing(TEST_REQUIREMENTS_FILES):
|
|
||||||
dest.write(open(source, 'r').read().rstrip('\n') + '\n')
|
|
||||||
|
|
||||||
|
|
||||||
class _PipInstallTestRequires(object):
|
|
||||||
"""Mixin class to install test-requirements.txt before running tests."""
|
|
||||||
|
|
||||||
def install_test_requirements(self):
|
|
||||||
|
|
||||||
links = parse_dependency_links(TEST_REQUIREMENTS_FILES)
|
|
||||||
if self.distribution.tests_require:
|
|
||||||
option_dict = self.distribution.get_option_dict('pbr')
|
|
||||||
_pip_install(
|
|
||||||
links, self.distribution.tests_require,
|
|
||||||
option_dict=option_dict)
|
|
||||||
|
|
||||||
def pre_run(self):
|
|
||||||
self.egg_name = pkg_resources.safe_name(self.distribution.get_name())
|
|
||||||
self.egg_info = "%s.egg-info" % pkg_resources.to_filename(
|
|
||||||
self.egg_name)
|
|
||||||
if (not os.path.exists(self.egg_info) or
|
|
||||||
_newer_requires_files(self.egg_info)):
|
|
||||||
ei_cmd = self.get_finalized_command('egg_info')
|
|
||||||
ei_cmd.run()
|
|
||||||
self.install_test_requirements()
|
|
||||||
_copy_test_requires_to(self.egg_info)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from pbr import testr_command
|
from pbr import testr_command
|
||||||
|
|
||||||
class TestrTest(testr_command.Testr, _PipInstallTestRequires):
|
class TestrTest(testr_command.Testr):
|
||||||
"""Make setup.py test do the right thing."""
|
"""Make setup.py test do the right thing."""
|
||||||
|
|
||||||
command_name = 'test'
|
command_name = 'test'
|
||||||
|
@ -255,7 +195,7 @@ def have_testr():
|
||||||
try:
|
try:
|
||||||
from nose import commands
|
from nose import commands
|
||||||
|
|
||||||
class NoseTest(commands.nosetests, _PipInstallTestRequires):
|
class NoseTest(commands.nosetests):
|
||||||
"""Fallback test runner if testr is a no-go."""
|
"""Fallback test runner if testr is a no-go."""
|
||||||
|
|
||||||
command_name = 'test'
|
command_name = 'test'
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
pip
|
|
1
tox.ini
1
tox.ini
|
@ -8,7 +8,6 @@ usedevelop = True
|
||||||
install_command = pip install {opts} {packages}
|
install_command = pip install {opts} {packages}
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
deps = .
|
deps = .
|
||||||
-r{toxinidir}/requirements.txt
|
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
commands =
|
commands =
|
||||||
python setup.py testr --testr-args='{posargs}'
|
python setup.py testr --testr-args='{posargs}'
|
||||||
|
|
Loading…
Reference in New Issue