Commit dc662c5d authored by Xavier Thompson's avatar Xavier Thompson

[tmp] Prevent pip installing build requirements

parent 4147f30b
......@@ -450,7 +450,7 @@ class Installer(object):
tmp = tempfile.mkdtemp(dir=dest)
try:
paths = call_pip_install(spec, tmp)
paths = call_pip_install(spec, tmp, self)
dists = []
env = pkg_resources.Environment(paths)
......@@ -482,7 +482,7 @@ class Installer(object):
result = []
for d in dists:
result.append(_move_to_eggs_dir_and_compile(d, dest))
result.append(_move_to_eggs_dir_and_compile(d, dest, self))
return result
......@@ -668,7 +668,7 @@ class Installer(object):
raise zc.buildout.UserError(
"Couldn't download distribution %s." % avail)
dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
dists = [_move_to_eggs_dir_and_compile(dist, self._dest, self)]
for _d in dists:
if _d not in ws:
ws.add(_d, replace=True)
......@@ -1815,7 +1815,7 @@ class IncompatibleConstraintError(zc.buildout.UserError):
IncompatibleVersionError = IncompatibleConstraintError # Backward compatibility
def call_pip_install(spec, dest):
def call_pip_install(spec, dest, options):
"""
Call `pip install` from a subprocess to install a
distribution specified by `spec` into `dest`.
......@@ -1828,6 +1828,12 @@ def call_pip_install(spec, dest):
else:
args.append('-v')
# Try to prevent pip from installing build dependencies implicitly
# and without respecting pinned versions, on the fly
if not options._allow_picked_versions:
args.append('--no-index')
args.append('--no-build-isolation')
args.append(spec)
try:
......@@ -2035,7 +2041,7 @@ def _get_matching_dist_in_location(dist, location):
if dist_infos == [(dist.project_name.lower(), dist.parsed_version)]:
return dists.pop()
def _move_to_eggs_dir_and_compile(dist, dest):
def _move_to_eggs_dir_and_compile(dist, dest, options):
"""Move distribution to the eggs destination directory.
And compile the py files, if we have actually moved the dist.
......@@ -2076,7 +2082,7 @@ def _move_to_eggs_dir_and_compile(dist, dest):
unpacker(dist.location, tmp_dest)
[tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
else:
[tmp_loc] = call_pip_install(dist.location, tmp_dest)
[tmp_loc] = call_pip_install(dist.location, tmp_dest, options)
installed_with_pip = True
# We have installed the dist. Now try to rename/move it.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment