mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Don't fail badly at this stage if importing is not possible.
This commit is contained in:
parent
7f8f1289a8
commit
af12ce06b5
@ -14,14 +14,24 @@ import msgpack
|
||||
import requests
|
||||
try:
|
||||
import urllib3
|
||||
HAS_URLLIB3 = True
|
||||
except ImportError:
|
||||
# Import the bundled package
|
||||
try:
|
||||
from requests.packages import urllib3
|
||||
HAS_URLLIB3 = True
|
||||
except ImportError:
|
||||
HAS_URLLIB3 = False
|
||||
try:
|
||||
import six
|
||||
HAS_SIX = True
|
||||
except ImportError:
|
||||
# Import the bundled package
|
||||
try:
|
||||
from requests.packages.urllib3.packages import six
|
||||
HAS_SIX = True
|
||||
except ImportError:
|
||||
HAS_SIX = False
|
||||
try:
|
||||
import markupsafe
|
||||
HAS_MARKUPSAFE = True
|
||||
@ -73,10 +83,15 @@ def gen_thin(cachedir, extra_mods='', overwrite=False):
|
||||
os.path.dirname(jinja2.__file__),
|
||||
os.path.dirname(yaml.__file__),
|
||||
os.path.dirname(msgpack.__file__),
|
||||
os.path.dirname(requests.__file__),
|
||||
os.path.dirname(urllib3.__file__),
|
||||
six.__file__.replace('.pyc', '.py'),
|
||||
os.path.dirname(requests.__file__)
|
||||
]
|
||||
|
||||
if HAS_URLLIB3:
|
||||
tops.append(os.path.dirname(urllib3.__file__))
|
||||
|
||||
if HAS_SIX:
|
||||
tops.append(six.__file__.replace('.pyc', '.py'))
|
||||
|
||||
for mod in [m for m in extra_mods.split(',') if m]:
|
||||
if mod not in locals() and mod not in globals():
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user