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 /setuptools/bootstrap.py | |
| parent | 4d4dbd3c5c69f63418ca2f22e9d6a3b8185b2e00 (diff) | |
| download | python-setuptools-git-7c5d53881122046a97420ba085d865f59458ddde.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.
--HG--
branch : feature/issue-229
Diffstat (limited to 'setuptools/bootstrap.py')
| -rw-r--r-- | setuptools/bootstrap.py | 27 |
1 files changed, 27 insertions, 0 deletions
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) |
