-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The layout here is very provisional based on what worked before commit 38a06fe. Issue: 365150653 Reviewed-on: youtube/cobalt#4786
- Loading branch information
1 parent
5e27148
commit d9aa791
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
"""Packages Cobalt for Android.""" | ||
|
||
import argparse | ||
import os | ||
import shutil | ||
import tempfile | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--name', required=True, help='of archive and base dir') | ||
parser.add_argument('out_dir', help='generated by GN and built by Ninja') | ||
parser.add_argument('package_dir', help='where to place the archive') | ||
args = parser.parse_args() | ||
package(args.out_dir, args.package_dir, args.name) | ||
|
||
|
||
def package(out_dir, package_dir, name): | ||
with tempfile.TemporaryDirectory() as tmp_dir: | ||
base_dir = os.path.join(tmp_dir, name) | ||
os.makedirs(base_dir) | ||
|
||
shutil.copy2(os.path.join(out_dir, 'apks/Cobalt.apk'), base_dir) | ||
shutil.copytree( | ||
os.path.join(out_dir, 'content'), | ||
os.path.join(base_dir, 'cobalt_package', 'content')) | ||
|
||
shutil.make_archive(os.path.join(package_dir, name), 'zip', tmp_dir) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters