mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
fix up the bundle support
This commit is contained in:
parent
4b1f064eb3
commit
d3cbb3f606
21
pip/req.py
21
pip/req.py
|
@ -37,7 +37,8 @@ from pip.wheel import move_wheel_files
|
|||
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 @@ class InstallRequirement(object):
|
|||
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 @@ exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
|
|||
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 @@ class RequirementSet(object):
|
|||
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
|
||||
|
|
BIN
tests/data/packages/simplebundle.pybundle
Normal file
BIN
tests/data/packages/simplebundle.pybundle
Normal file
Binary file not shown.
11
tests/functional/test_install_bundle.py
Normal file
11
tests/functional/test_install_bundle.py
Normal file
|
@ -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)
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue