diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-12 23:18:06 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-12 23:33:14 +0300 |
commit | 06526e7ccc3eb3aad5e470ca2043a479d794d59f (patch) | |
tree | 4d70a7495507458e8f4bbbc75306404ac6c0f738 /tools | |
parent | 82c7b1b1d5c8ce0467bd580a86d20c645cec17df (diff) | |
download | micropython-06526e7ccc3eb3aad5e470ca2043a479d794d59f.tar.gz micropython-06526e7ccc3eb3aad5e470ca2043a479d794d59f.zip |
pip-micropython: Apply more workarounds for setuptools, pip, etc misfeatures.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/pip-micropython | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/pip-micropython b/tools/pip-micropython index fab8809839..d5b84b0e25 100755 --- a/tools/pip-micropython +++ b/tools/pip-micropython @@ -30,6 +30,21 @@ fi # installed if it's already installed for main python distribution. if [ ! -d /tmp/pip-micropy-venv ]; then virtualenv --no-site-packages /tmp/pip-micropy-venv + # distutils, setuptools, pip are buggy and allow target packages affect + # their execution environment. For example, if distribution they install + # has re.py, they will import that instead of system re. So, we need + # to remove current dir from sys.path, but that appear to be quite uneasy + # with CPython, so we hook __import__ and exterminate it persistently. + # See also https://bitbucket.org/pypa/setuptools/issue/187/ + cat > $(ls -1d /tmp/pip-micropy-venv/lib/python*/)/sitecustomize.py <<EOF +import sys +import __builtin__ +old_imp = __import__ +def new_imp(*a, **kw): + if not sys.path[0]: sys.path.pop(0) + return old_imp(*a, **kw) +__builtin__.__import__ = new_imp +EOF fi . /tmp/pip-micropy-venv/bin/activate |