Skip to content

Fix up the bundle support #1116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions pip/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file added tests/data/packages/simplebundle.pybundle
Binary file not shown.
11 changes: 11 additions & 0 deletions tests/functional/test_install_bundle.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion tests/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down