File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030# installed if it's already installed for main python distribution.
3131if [ ! -d /tmp/pip-micropy-venv ]; then
3232 virtualenv --no-site-packages /tmp/pip-micropy-venv
33+ # distutils, setuptools, pip are buggy and allow target packages affect
34+ # their execution environment. For example, if distribution they install
35+ # has re.py, they will import that instead of system re. So, we need
36+ # to remove current dir from sys.path, but that appear to be quite uneasy
37+ # with CPython, so we hook __import__ and exterminate it persistently.
38+ # See also https://bitbucket.org/pypa/setuptools/issue/187/
39+ cat > $( ls -1d /tmp/pip-micropy-venv/lib/python* /) /sitecustomize.py << EOF
40+ import sys
41+ import __builtin__
42+ old_imp = __import__
43+ def new_imp(*a, **kw):
44+ if not sys.path[0]: sys.path.pop(0)
45+ return old_imp(*a, **kw)
46+ __builtin__.__import__ = new_imp
47+ EOF
3348fi
3449. /tmp/pip-micropy-venv/bin/activate
3550
You can’t perform that action at this time.
0 commit comments