Skip to content

Commit cbfe4e0

Browse files
committed
Merge pull request #1116 from qwcode/fix_bundle
Fix up the bundle support
2 parents 4b1f064 + d3cbb3f commit cbfe4e0

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

pip/req.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
class InstallRequirement(object):
3838

3939
def __init__(self, req, comes_from, source_dir=None, editable=False,
40-
url=None, as_egg=False, update=True, prereleases=None):
40+
url=None, as_egg=False, update=True, prereleases=None,
41+
from_bundle=False):
4142
self.extras = ()
4243
if isinstance(req, string_types):
4344
req = pkg_resources.Requirement.parse(req)
@@ -65,6 +66,7 @@ def __init__(self, req, comes_from, source_dir=None, editable=False,
6566
self.uninstalled = None
6667
self.use_user_site = False
6768
self.target_dir = None
69+
self.from_bundle = from_bundle
6870

6971
# True if pre-releases are acceptable
7072
if prereleases:
@@ -776,12 +778,10 @@ def bundle_requirements(self):
776778
url = None
777779
yield InstallRequirement(
778780
package, self, editable=True, url=url,
779-
update=False, source_dir=dest_dir)
781+
update=False, source_dir=dest_dir, from_bundle=True)
780782
for dest_dir in self._bundle_build_dirs:
781783
package = os.path.basename(dest_dir)
782-
yield InstallRequirement(
783-
package, self,
784-
source_dir=dest_dir)
784+
yield InstallRequirement(package, self,source_dir=dest_dir, from_bundle=True)
785785

786786
def move_bundle_files(self, dest_build_dir, dest_src_dir):
787787
base = self._temp_build_dir
@@ -1059,9 +1059,14 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
10591059
unpack = True
10601060
url = None
10611061

1062-
# If a checkout exists, it's unwise to keep going.
1063-
# Version inconsistencies are logged later, but do not fail the installation.
1064-
if os.path.exists(os.path.join(location, 'setup.py')):
1062+
# In the case where the req comes from a bundle, we should
1063+
# assume a build dir exists and move on
1064+
if req_to_install.from_bundle:
1065+
pass
1066+
# If a checkout exists, it's unwise to keep going. version
1067+
# inconsistencies are logged later, but do not fail the
1068+
# installation.
1069+
elif os.path.exists(os.path.join(location, 'setup.py')):
10651070
msg = textwrap.dedent("""
10661071
pip can't proceed with requirement '%s' due to a pre-existing build directory.
10671072
location: %s
4.25 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os
2+
from tests.lib import reset_env, pip_install_local, packages
3+
4+
def test_install_pybundle():
5+
"""
6+
Test intalling a *.pybundle file
7+
"""
8+
env = reset_env()
9+
result = pip_install_local(os.path.join(packages, 'simplebundle.pybundle'), expect_temp=True)
10+
result.assert_installed('simple', editable=False)
11+
result.assert_installed('simple2', editable=False)

tests/lib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def run_pip(*args, **kw):
451451

452452
def pip_install_local(*args, **kw):
453453
"""Run 'pip install' using --find-links against our local test packages"""
454-
run_pip('install', '--no-index', '--find-links=%s' % find_links, *args, **kw)
454+
return run_pip('install', '--no-index', '--find-links=%s' % find_links, *args, **kw)
455455

456456
def write_file(filename, text, dest=None):
457457
"""Write a file in the dest (default=env.scratch_path)

0 commit comments

Comments
 (0)