ignore missing/bad device-specific releasetools modules
If we fail to load the device-specific releasetools module (ie, if -s is specified but the file is missing), issue an error message but continue without any device-specific code.
This commit is contained in:
@@ -432,17 +432,18 @@ class DeviceSpecificParams(object):
|
|||||||
if self.module is None:
|
if self.module is None:
|
||||||
path = OPTIONS.device_specific
|
path = OPTIONS.device_specific
|
||||||
if path is None: return
|
if path is None: return
|
||||||
if os.path.isdir(path):
|
try:
|
||||||
info = imp.find_module("releasetools", [path])
|
if os.path.isdir(path):
|
||||||
else:
|
info = imp.find_module("releasetools", [path])
|
||||||
d, f = os.path.split(path)
|
else:
|
||||||
b, x = os.path.splitext(f)
|
d, f = os.path.split(path)
|
||||||
if x == ".py":
|
b, x = os.path.splitext(f)
|
||||||
f = b
|
if x == ".py":
|
||||||
info = imp.find_module(f, [d])
|
f = b
|
||||||
if not info or info[0] is None:
|
info = imp.find_module(f, [d])
|
||||||
raise ValueError("unable to find device-specific module")
|
self.module = imp.load_module("device_specific", *info)
|
||||||
self.module = imp.load_module("device_specific", *info)
|
except ImportError:
|
||||||
|
print "unable to load device-specific module; assuming none"
|
||||||
|
|
||||||
def _DoCall(self, function_name, *args, **kwargs):
|
def _DoCall(self, function_name, *args, **kwargs):
|
||||||
"""Call the named function in the device-specific module, passing
|
"""Call the named function in the device-specific module, passing
|
||||||
|
Reference in New Issue
Block a user