diff --git a/pip/req.py b/pip/req.py index 5742e62ce07..93af61c9d33 100644 --- a/pip/req.py +++ b/pip/req.py @@ -37,7 +37,8 @@ class InstallRequirement(object): def __init__(self, req, comes_from, source_dir=None, editable=False, - url=None, as_egg=False, update=True, prereleases=None): + url=None, as_egg=False, update=True, prereleases=None, + from_bundle=False): self.extras = () if isinstance(req, string_types): req = pkg_resources.Requirement.parse(req) @@ -65,6 +66,7 @@ def __init__(self, req, comes_from, source_dir=None, editable=False, self.uninstalled = None self.use_user_site = False self.target_dir = None + self.from_bundle = from_bundle # True if pre-releases are acceptable if prereleases: @@ -776,12 +778,10 @@ def bundle_requirements(self): url = None yield InstallRequirement( package, self, editable=True, url=url, - update=False, source_dir=dest_dir) + update=False, source_dir=dest_dir, from_bundle=True) for dest_dir in self._bundle_build_dirs: package = os.path.basename(dest_dir) - yield InstallRequirement( - package, self, - source_dir=dest_dir) + yield InstallRequirement(package, self,source_dir=dest_dir, from_bundle=True) def move_bundle_files(self, dest_build_dir, dest_src_dir): base = self._temp_build_dir @@ -1059,9 +1059,14 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False): unpack = True url = None - # If a checkout exists, it's unwise to keep going. - # Version inconsistencies are logged later, but do not fail the installation. - if os.path.exists(os.path.join(location, 'setup.py')): + # In the case where the req comes from a bundle, we should + # assume a build dir exists and move on + if req_to_install.from_bundle: + pass + # If a checkout exists, it's unwise to keep going. version + # inconsistencies are logged later, but do not fail the + # installation. + elif os.path.exists(os.path.join(location, 'setup.py')): msg = textwrap.dedent(""" pip can't proceed with requirement '%s' due to a pre-existing build directory. location: %s diff --git a/tests/data/packages/simplebundle.pybundle b/tests/data/packages/simplebundle.pybundle new file mode 100644 index 00000000000..e8bb889971e Binary files /dev/null and b/tests/data/packages/simplebundle.pybundle differ diff --git a/tests/functional/test_install_bundle.py b/tests/functional/test_install_bundle.py new file mode 100644 index 00000000000..ea45f30efb7 --- /dev/null +++ b/tests/functional/test_install_bundle.py @@ -0,0 +1,11 @@ +import os +from tests.lib import reset_env, pip_install_local, packages + +def test_install_pybundle(): + """ + Test intalling a *.pybundle file + """ + env = reset_env() + result = pip_install_local(os.path.join(packages, 'simplebundle.pybundle'), expect_temp=True) + result.assert_installed('simple', editable=False) + result.assert_installed('simple2', editable=False) diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index aebbd5faf68..b877259afaf 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -451,7 +451,7 @@ def run_pip(*args, **kw): def pip_install_local(*args, **kw): """Run 'pip install' using --find-links against our local test packages""" - run_pip('install', '--no-index', '--find-links=%s' % find_links, *args, **kw) + return run_pip('install', '--no-index', '--find-links=%s' % find_links, *args, **kw) def write_file(filename, text, dest=None): """Write a file in the dest (default=env.scratch_path)