Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: services/android/add_manifest_entry.py

Issue 1239353002: Move rules for building Android Mojo services to //mojo/android (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/android/rules.gni ('k') | services/android/rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/android/add_manifest_entry.py
diff --git a/services/android/add_manifest_entry.py b/services/android/add_manifest_entry.py
deleted file mode 100755
index a00052e90aa1fe3c86b079bf58a2d42e363899cc..0000000000000000000000000000000000000000
--- a/services/android/add_manifest_entry.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Add an entry into the manifest file of a jar file."""
-
-import optparse
-import os
-import os.path
-import sys
-import shutil
-import tempfile
-import zipfile
-
-def AddKey(input_jar, output, key, value):
- working_dir = tempfile.mkdtemp()
- extracted_dir = os.path.join(working_dir, 'extracted')
- try:
- with zipfile.ZipFile(input_jar) as zf:
- zf.extractall(extracted_dir)
- manifest_file = os.path.join(extracted_dir, 'META-INF', 'MANIFEST.MF')
- manifest_content = ''
- if os.path.isfile(manifest_file):
- with open(manifest_file, 'r') as f:
- manifest_content = f.read().strip()
- if len(manifest_content):
- manifest_content += '\n'
- os.unlink(manifest_file)
- manifest_content += '%s: %s\n' % (key, value)
- with open(manifest_file, 'w') as f:
- f.write(manifest_content)
- shutil.make_archive(os.path.join(working_dir, 'output'), 'zip',
- extracted_dir, '.')
- shutil.move(os.path.join(working_dir, 'output.zip'), output)
- finally:
- shutil.rmtree(working_dir)
-
-
-def main():
- parser = optparse.OptionParser()
-
- parser.add_option('--input', help='Name of the input jar.')
- parser.add_option('--output', help='Name of the output jar.')
- parser.add_option('--key', help='Name of the key to add to the manifest.')
- parser.add_option('--value', help='Name of the value to add to the manifest.')
-
- options, _ = parser.parse_args()
- AddKey(options.input, options.output, options.key, options.value)
-
-
-if __name__ == '__main__':
- sys.exit(main())
« no previous file with comments | « mojo/android/rules.gni ('k') | services/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698