From d67f22fc3fa7e4ca7de5406edf3df4446509b01f Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 11 May 2015 14:18:25 +1200 Subject: 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 --- doc/source/packagers.rst | 24 +++++++++--------- pbr/packaging.py | 64 ++---------------------------------------------- requirements.txt | 1 - tox.ini | 1 - 4 files changed, 15 insertions(+), 75 deletions(-) delete mode 100644 requirements.txt diff --git a/doc/source/packagers.rst b/doc/source/packagers.rst index e135b57..29fc86e 100644 --- a/doc/source/packagers.rst +++ b/doc/source/packagers.rst @@ -42,17 +42,19 @@ versions as versions of the release before. Dependencies ============ -`pbr` overrides almost everything having to do with python dependency -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`: - -:: - - SKIP_PIP_INSTALL=1 - -will cause all logic around use of `pip` to be skipped, including the logic -that includes pip as a dependency of `pbr` itself. +As of 1.0.0 `pbr` doesn't alter the dependency behaviour of `setuptools`. + +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. + +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 +it. Tarballs ======== diff --git a/pbr/packaging.py b/pbr/packaging.py index 4b47043..ebf1a8d 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -68,23 +68,6 @@ def append_text_list(config, key, text_list): 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): 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) -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: from pbr import testr_command - class TestrTest(testr_command.Testr, _PipInstallTestRequires): + class TestrTest(testr_command.Testr): """Make setup.py test do the right thing.""" command_name = 'test' @@ -255,7 +195,7 @@ def have_testr(): try: from nose import commands - class NoseTest(commands.nosetests, _PipInstallTestRequires): + class NoseTest(commands.nosetests): """Fallback test runner if testr is a no-go.""" command_name = 'test' diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a1b589e..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/tox.ini b/tox.ini index 55e378b..7c98b5a 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,6 @@ usedevelop = True install_command = pip install {opts} {packages} setenv = VIRTUAL_ENV={envdir} deps = . - -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = python setup.py testr --testr-args='{posargs}' -- cgit v1.2.1