From ddb91c20793d8e5e8a01e0302afeaaba76776741 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 31 Dec 2015 16:38:40 -0500 Subject: Make the technique even more generic --HG-- branch : feature/issue-229 --- setuptools/extern/six.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'setuptools') diff --git a/setuptools/extern/six.py b/setuptools/extern/six.py index 2685c5e6..6076c208 100644 --- a/setuptools/extern/six.py +++ b/setuptools/extern/six.py @@ -1,11 +1,11 @@ """ -Handle loading six package from system or from the bundled copy +Handle loading a package from system or from the bundled copy """ import imp -_SIX_SEARCH_PATH = ['setuptools._vendor.six', 'six'] +_SEARCH_PATH = ['setuptools._vendor.six', 'six'] def _find_module(name, path=None): @@ -24,7 +24,7 @@ def _find_module(name, path=None): return fh, path, descr -def _import_six(search_path=_SIX_SEARCH_PATH): +def _import_in_place(search_path=_SEARCH_PATH): for mod_name in search_path: try: mod_info = _find_module(mod_name) @@ -32,15 +32,14 @@ def _import_six(search_path=_SIX_SEARCH_PATH): continue imp.load_module(__name__, *mod_info) - break else: raise ImportError( - "The 'six' module of minimum version {0} is required; " + "The '{name}' package is required; " "normally this is bundled with this package so if you get " "this warning, consult the packager of your " - "distribution.") + "distribution.".format(name=_SEARCH_PATH[-1])) -_import_six() +_import_in_place() -- cgit v1.2.1