aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/bundle.py
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-04-28 20:24:56 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-04-28 20:24:56 +0000
commit656c7c0fa0d9b776c019f5423e01a9a28979d2bd (patch)
tree220a95d346d58fa5090d8033991bcfef2ad03d99 /compiler_wrapper/bundle.py
parent091406baac88deeb2ef9c71d5047bd9daf3915ef (diff)
parentccead650bb8e050400f55dc44b60f989b1f8e117 (diff)
downloadtoolchain-utils-android12-mainline-tzdata-release.tar.gz
Change-Id: I3464301d9b41d48e11dfd361a411d60a1bd5a429
Diffstat (limited to 'compiler_wrapper/bundle.py')
-rwxr-xr-xcompiler_wrapper/bundle.py67
1 files changed, 0 insertions, 67 deletions
diff --git a/compiler_wrapper/bundle.py b/compiler_wrapper/bundle.py
deleted file mode 100755
index c1fa53e0..00000000
--- a/compiler_wrapper/bundle.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Build script that copies the go sources to a build destination."""
-
-from __future__ import print_function
-
-import argparse
-import os.path
-import re
-import shutil
-import subprocess
-import sys
-
-
-def parse_args():
- parser = argparse.ArgumentParser()
- parser.add_argument('output_dir')
- return parser.parse_args()
-
-
-def copy_files(input_dir, output_dir):
- for filename in os.listdir(input_dir):
- if ((filename.endswith('.go') and not filename.endswith('_test.go')) or
- filename == 'build.py'):
- shutil.copy(
- os.path.join(input_dir, filename), os.path.join(output_dir, filename))
-
-
-def read_change_id(input_dir):
- last_commit_msg = subprocess.check_output(
- ['git', '-C', input_dir, 'log', '-1', '--pretty=%B'])
- # Use last found change id to support reverts as well.
- change_ids = re.findall(r'Change-Id: (\w+)', last_commit_msg)
- if not change_ids:
- sys.exit("Couldn't find Change-Id in last commit message.")
- return change_ids[-1]
-
-
-def write_readme(input_dir, output_dir, change_id):
- with open(os.path.join(input_dir, 'bundle.README'), 'r') as r, \
- open(os.path.join(output_dir, 'README'), 'w') as w:
- content = r.read()
- w.write(content.format(change_id=change_id))
-
-
-def write_version(output_dir, change_id):
- with open(os.path.join(output_dir, 'VERSION'), 'w') as w:
- w.write(change_id)
-
-
-def main():
- args = parse_args()
- input_dir = os.path.dirname(__file__)
- change_id = read_change_id(input_dir)
- shutil.rmtree(args.output_dir, ignore_errors=True)
- os.makedirs(args.output_dir)
- copy_files(input_dir, args.output_dir)
- write_readme(input_dir, args.output_dir, change_id)
- write_version(args.output_dir, change_id)
-
-
-if __name__ == '__main__':
- main()