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

Unified Diff: mojo/tools/upload_shell_binary.py

Issue 707893005: Add mojo/tools/mopy with paths and version utilities (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« mojo/tools/mopy/paths.py ('K') | « mojo/tools/test_runner.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/upload_shell_binary.py
diff --git a/mojo/tools/upload_shell_binary.py b/mojo/tools/upload_shell_binary.py
index f9c1ff1f697b76ec2f0e58eee97ca46abcc3702f..91c0ed9239fd500ab2ed3d437aa497992710af05 100755
--- a/mojo/tools/upload_shell_binary.py
+++ b/mojo/tools/upload_shell_binary.py
@@ -11,30 +11,30 @@ import tempfile
import time
import zipfile
-root_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..")
+from mopy.paths import Paths
+from mopy.version import Version
-sys.path.insert(0, os.path.join(root_path, "tools"))
+paths = Paths(os.path.join("out", "Release"))
+
+sys.path.insert(0, os.path.join(paths.src_root, "tools"))
# pylint: disable=F0401
import find_depot_tools
-binary_path = os.path.join(root_path, "out", "Release", "mojo_shell")
-
depot_tools_path = find_depot_tools.add_depot_tools_to_path()
gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil")
-def upload(dry_run):
- version = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=root_path)
- version = version.strip()
- dest = "gs://mojo/shell/" + version + "/linux-x64.zip"
+def upload(dry_run, verbose):
+ dest = "gs://mojo/shell/" + Version().version + "/linux-x64.zip"
with tempfile.NamedTemporaryFile() as zip_file:
with zipfile.ZipFile(zip_file, 'w') as z:
- with open(binary_path) as shell_binary:
+ with open(paths.mojo_shell_path) as shell_binary:
zipinfo = zipfile.ZipInfo("mojo_shell")
zipinfo.external_attr = 0777 << 16L
zipinfo.compress_type = zipfile.ZIP_DEFLATED
- zipinfo.date_time = time.gmtime(os.path.getmtime(binary_path))
+ zipinfo.date_time = time.gmtime(os.path.getmtime(paths.mojo_shell_path))
+ if verbose:
+ print "zipping %s" % paths.mojo_shell_path
z.writestr(zipinfo, shell_binary.read())
if dry_run:
print str([gsutil_exe, "cp", zip_file.name, dest])
@@ -46,8 +46,10 @@ def main():
"google storage")
parser.add_argument("-n", "--dry_run", help="Dry run, do not actually "+
"upload", action="store_true")
+ parser.add_argument("-v", "--verbose", help="Verbose mode",
+ action="store_true")
args = parser.parse_args()
- upload(args.dry_run)
+ upload(args.dry_run, args.verbose)
return 0
if __name__ == "__main__":
« mojo/tools/mopy/paths.py ('K') | « mojo/tools/test_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698