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 | 43bcb5ea6c1f955e33fdd463433cc0f35013f40f (patch) | |
tree | 21ab8fa13798628b440f90763fcfb9d26b532ff5 /setuptools | |
parent | 82ff46cb011b5d3f5112ab3519d116d94c03d216 (diff) | |
download | python-setuptools-bitbucket-43bcb5ea6c1f955e33fdd463433cc0f35013f40f.tar.gz |
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.
Diffstat (limited to 'setuptools')
-rw-r--r-- | setuptools/__init__.py | 2 | ||||
-rw-r--r-- | setuptools/_vendor/six-1.7.3.egg | bin | 0 -> 8240 bytes | |||
-rw-r--r-- | setuptools/bootstrap.py | 27 |
3 files changed, 29 insertions, 0 deletions
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/setuptools/_vendor/six-1.7.3.egg b/setuptools/_vendor/six-1.7.3.egg Binary files differnew file mode 100644 index 00000000..fe3e82c6 --- /dev/null +++ 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) |