prefer releasetools.py from target_files zip
If the target_files zip for the target build contains a META/releasetools.py (which it has since Nov 2013), prefer that over using a releasetools.py from the local client. Explicitly specifying the device-specific extensions path via command-line options takes priority over both of the above mechanisms. Change-Id: Ia068b0e2e06ede7da89ebe4315cdec592eb8995e
This commit is contained in:
@@ -756,6 +756,7 @@ class DeviceSpecificParams(object):
|
|||||||
if x == ".py":
|
if x == ".py":
|
||||||
f = b
|
f = b
|
||||||
info = imp.find_module(f, [d])
|
info = imp.find_module(f, [d])
|
||||||
|
print "loaded device-specific extensions from", path
|
||||||
self.module = imp.load_module("device_specific", *info)
|
self.module = imp.load_module("device_specific", *info)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print "unable to load device-specific module; assuming none"
|
print "unable to load device-specific module; assuming none"
|
||||||
|
@@ -1011,11 +1011,23 @@ def main(argv):
|
|||||||
print "--- target info ---"
|
print "--- target info ---"
|
||||||
common.DumpInfoDict(OPTIONS.info_dict)
|
common.DumpInfoDict(OPTIONS.info_dict)
|
||||||
|
|
||||||
|
# If the caller explicitly specified the device-specific extensions
|
||||||
|
# path via -s/--device_specific, use that. Otherwise, use
|
||||||
|
# META/releasetools.py if it is present in the target target_files.
|
||||||
|
# Otherwise, take the path of the file from 'tool_extensions' in the
|
||||||
|
# info dict and look for that in the local filesystem, relative to
|
||||||
|
# the current directory.
|
||||||
|
|
||||||
if OPTIONS.device_specific is None:
|
if OPTIONS.device_specific is None:
|
||||||
|
from_input = os.path.join(OPTIONS.input_tmp, "META", "releasetools.py")
|
||||||
|
if os.path.exists(from_input):
|
||||||
|
print "(using device-specific extensions from target_files)"
|
||||||
|
OPTIONS.device_specific = from_input
|
||||||
|
else:
|
||||||
OPTIONS.device_specific = OPTIONS.info_dict.get("tool_extensions", None)
|
OPTIONS.device_specific = OPTIONS.info_dict.get("tool_extensions", None)
|
||||||
|
|
||||||
if OPTIONS.device_specific is not None:
|
if OPTIONS.device_specific is not None:
|
||||||
OPTIONS.device_specific = os.path.normpath(OPTIONS.device_specific)
|
OPTIONS.device_specific = os.path.abspath(OPTIONS.device_specific)
|
||||||
print "using device-specific extensions in", OPTIONS.device_specific
|
|
||||||
|
|
||||||
temp_zip_file = tempfile.NamedTemporaryFile()
|
temp_zip_file = tempfile.NamedTemporaryFile()
|
||||||
output_zip = zipfile.ZipFile(temp_zip_file, "w",
|
output_zip = zipfile.ZipFile(temp_zip_file, "w",
|
||||||
|
Reference in New Issue
Block a user