Fix error when using -p
args.file is never set after Ieb9a87f16cf5e1c07a65186eff5df26d4ffcdd33,
add a helper function to get the file instead to fix:
Traceback (most recent call last):
File "./update_current.py", line 576, in <module>
if args.file:
AttributeError: 'Namespace' object has no attribute 'file'
Test: ./update_current.py -p 4583087
Change-Id: I4fdcf76a267e70f3eb3f3ec8a641983fd91b8357
diff --git a/update_current.py b/update_current.py
index bb80208..d82ce94 100755
--- a/update_current.py
+++ b/update_current.py
@@ -481,6 +481,13 @@
else:
raise Exception('Updating this set of prebuilts requires <source> to be a numeric build id, not "' + source + '"')
+def getFile(args):
+ source = args.source
+ if not source.isnumeric():
+ return args.source
+ else:
+ raise Exception('Updating this set of prebuilts requires <source> to be file, not a numeric build id')
+
parser = argparse.ArgumentParser(
description=('Update current prebuilts'))
parser.add_argument(
@@ -552,10 +559,7 @@
print_e('Failed to update platform SDK, aborting...')
sys.exit(1)
if args.design:
- if not args.file:
- print_e('Design Library must have --file specified')
- sys.exit(1)
- elif update_design(args.file):
+ if update_design(getFile(args)):
components = append(components, 'Design Library')
else:
print_e('Failed to update platform SDK, aborting...')
@@ -573,7 +577,7 @@
subprocess.check_call(['git', 'add', current_path])
subprocess.check_call(['git', 'add', system_path])
subprocess.check_call(['git', 'add', buildtools_dir])
- if args.file:
+ if not args.source.isnumeric():
src_msg = "local Maven ZIP"
else:
src_msg = "build %s" % (getBuildId(args))