diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/python.go | 1 | ||||
-rw-r--r-- | python/scripts/precompile_python.py | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/python/python.go b/python/python.go index d3cbd7695..2b1974eb8 100644 --- a/python/python.go +++ b/python/python.go @@ -545,7 +545,6 @@ func (p *PythonLibraryModule) createSrcsZip(ctx android.ModuleContext, pkgPath s var stagedProtoSrcs android.Paths for _, srcFile := range protoSrcs { stagedProtoSrc := pkgPathStagingDir.Join(ctx, pkgPath, srcFile.Rel()) - rule.Command().Text("mkdir -p").Flag(filepath.Base(stagedProtoSrc.String())) rule.Command().Text("cp -f").Input(srcFile).Output(stagedProtoSrc) stagedProtoSrcs = append(stagedProtoSrcs, stagedProtoSrc) } diff --git a/python/scripts/precompile_python.py b/python/scripts/precompile_python.py index aa1a5df53..07b8fe97b 100644 --- a/python/scripts/precompile_python.py +++ b/python/scripts/precompile_python.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function import argparse import py_compile import os @@ -63,11 +64,23 @@ def main(): parser.add_argument('dst_zip') args = parser.parse_args() + errors = [] with open(args.dst_zip, 'wb') as outf, open(args.src_zip, 'rb') as inf: with zipfile.ZipFile(outf, mode='w') as outzip, zipfile.ZipFile(inf, mode='r') as inzip: for name in inzip.namelist(): with inzip.open(name, mode='r') as inzipf: - process_one_file(name, inzipf, outzip) + try: + process_one_file(name, inzipf, outzip) + except py_compile.PyCompileError as e: + errors.append(e) + + if errors: + for i, error in enumerate(errors): + # Print an empty line in between each error + if i > 0: + print(file=sys.stderr) + print(str(error).strip(), file=sys.stderr) + sys.exit(1) if __name__ == "__main__": |