Commit 57cdb096 authored by Julien Muchembled's avatar Julien Muchembled Committed by Xavier Thompson

Do not allow setuptools to obtain eggs, unless picked versions are allowed

parent 9214fd01
...@@ -181,6 +181,17 @@ def _execute_permission(): ...@@ -181,6 +181,17 @@ def _execute_permission():
_easy_install_cmd = 'from setuptools.command.easy_install import main; main()' _easy_install_cmd = 'from setuptools.command.easy_install import main; main()'
_easy_install_cmd_no_install_setup_requires = """\
from setuptools import sandbox
from contextlib import contextmanager
def setup_context(*args):
with sandbox_setup_context(*args):
from pkg_resources import Environment
Environment.obtain = lambda *_: None
yield
sandbox_setup_context = sandbox.setup_context
sandbox.setup_context = contextmanager(setup_context)
""" + _easy_install_cmd
_doing_list = type('', (), {'__mod__': staticmethod( _doing_list = type('', (), {'__mod__': staticmethod(
lambda x: '\n '.join(*x))})() lambda x: '\n '.join(*x))})()
...@@ -358,8 +369,10 @@ class Installer: ...@@ -358,8 +369,10 @@ class Installer:
path = setuptools_pythonpath path = setuptools_pythonpath
args = [sys.executable, '-c', args = [sys.executable, '-c',
('import sys; sys.path[0:0] = [%r]; ' % path) + 'import sys; sys.path[0:0] = [%r]; ' % path + (
_easy_install_cmd, '-mZUNxd', tmp] _easy_install_cmd if self._allow_picked_versions else
_easy_install_cmd_no_install_setup_requires),
'-mZUNxd', tmp]
level = logger.getEffectiveLevel() level = logger.getEffectiveLevel()
if level > 0: if level > 0:
args.append('-q') args.append('-q')
......
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