diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-11-16 10:30:23 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-11-16 10:30:23 -0500 |
commit | 7c5d53881122046a97420ba085d865f59458ddde (patch) | |
tree | 3bc51a54368651b8ecd7aafcbc0e3da11613a932 | |
parent | 4d4dbd3c5c69f63418ca2f22e9d6a3b8185b2e00 (diff) | |
download | external_python_setuptools-7c5d53881122046a97420ba085d865f59458ddde.tar.gz external_python_setuptools-7c5d53881122046a97420ba085d865f59458ddde.tar.bz2 external_python_setuptools-7c5d53881122046a97420ba085d865f59458ddde.zip |
Trying a new technique. In this approach, setuptools is aware of its dependencies and when imported makes sure the vendored versions are present on sys.path.
--HG--
branch : feature/issue-229
-rw-r--r-- | .travis.yml | 1 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | setuptools/__init__.py | 2 | ||||
-rw-r--r-- | setuptools/_vendor/six-1.7.3.egg (renamed from six-1.7.3.egg) | bin | 8240 -> 8240 bytes | |||
-rw-r--r-- | setuptools/bootstrap.py | 27 |
5 files changed, 29 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml index 15268ccc..22541671 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ python: - pypy # command to run tests script: - - export PYTHONPATH=`pwd`/six-*.egg - python setup.py egg_info - python setup.py test - python setup.py ptr @@ -6,8 +6,6 @@ import sys import textwrap import contextlib -sys.path.append('six-1.7.3.egg') - # Allow to run setup.py from another directory. os.chdir(os.path.dirname(os.path.abspath(__file__))) diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 920dad38..c885555d 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -1,5 +1,7 @@ """Extensions to the 'distutils' for large or complex distributions""" +__import__('setuptools.bootstrap').bootstrap.ensure_deps() + import os import sys import distutils.core diff --git a/six-1.7.3.egg b/setuptools/_vendor/six-1.7.3.egg Binary files differindex fe3e82c6..fe3e82c6 100644 --- a/six-1.7.3.egg +++ b/setuptools/_vendor/six-1.7.3.egg diff --git a/setuptools/bootstrap.py b/setuptools/bootstrap.py new file mode 100644 index 00000000..0cd95778 --- /dev/null +++ b/setuptools/bootstrap.py @@ -0,0 +1,27 @@ +""" +When setuptools is installed in a clean environment, it doesn't have its +dependencies, so it can't run to install its dependencies. This module +checks those dependencies and if one or more are missing, it uses vendored +versions. +""" + +import os +import sys +import glob + +def ensure_deps(): + """ + Detect if dependencies are installed and if not, use vendored versions. + """ + try: + __import__('six') + except ImportError: + use_vendor_deps() + +def use_vendor_deps(): + """ + Use vendored versions + """ + here = os.path.dirname(__file__) + eggs = glob.glob(here + '/_vendor/*.egg') + sys.path.extend(eggs) |