Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a054089

Browse files
authored
cleanup gen_package.py (#13089)
1 parent 3871bc4 commit a054089

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

tools/fuchsia/gen_package.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def GenerateManifest(package_dir):
2424
common_prefix = os.path.commonprefix([root, package_dir])
2525
rel_path = os.path.relpath(os.path.join(root, f), common_prefix)
2626
from_package = os.path.abspath(os.path.join(package_dir, rel_path))
27+
assert from_package, 'Failed to create from_package for %s' % os.path.join(root, f)
2728
full_paths.append('%s=%s' % (rel_path, from_package))
2829
parent_dir = os.path.abspath(os.path.join(package_dir, os.pardir))
2930
manifest_file_name = os.path.basename(package_dir) + '.manifest'
@@ -42,10 +43,10 @@ def CreateFarPackage(pm_bin, package_dir, signing_key, dst_dir):
4243
]
4344

4445
# Build the package
45-
subprocess.check_call(pm_command_base + ['build'])
46+
subprocess.check_output(pm_command_base + ['build'])
4647

4748
# Archive the package
48-
subprocess.check_call(pm_command_base + ['archive'])
49+
subprocess.check_output(pm_command_base + ['archive'])
4950

5051
return 0
5152

@@ -90,20 +91,16 @@ def main():
9091
manifest_file,
9192
]
9293

93-
# Build the package
94-
try:
95-
output = subprocess.check_output(pm_command_base + ['build'])
96-
except subprocess.CalledProcessError as e:
97-
print('The "%s" command failed:' % e.cmd)
98-
print(e.output)
99-
raise
100-
101-
# Archive the package
94+
# Build and then archive the package
95+
# Use check_output so if anything goes wrong we get the output.
10296
try:
103-
output = subprocess.check_output(pm_command_base + ['archive'])
97+
subprocess.check_output(pm_command_base + ['build'])
98+
subprocess.check_output(pm_command_base + ['archive'])
10499
except subprocess.CalledProcessError as e:
105-
print('The "%s" command failed:' % e.cmd)
106-
print(e.output)
100+
print('==================== Manifest contents =========================================')
101+
with open(manifest_file, 'r') as manifest:
102+
print(manifest.read())
103+
print('==================== End manifest contents =====================================')
107104
raise
108105

109106
return 0

0 commit comments

Comments
 (0)