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

Unified Diff: experimental/mojo/generate.py

Issue 1660043004: SkMojo: generate on Darwin/x86_64 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | gyp/skmojo.gyp » ('j') | gyp/skmojo.gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/mojo/generate.py
diff --git a/experimental/mojo/generate.py b/experimental/mojo/generate.py
index a32afbba8005b209b566da98a9bd73df13ef3856..f44ca5ebc8c7ce7703ad04bb477f5d020cc6107e 100755
--- a/experimental/mojo/generate.py
+++ b/experimental/mojo/generate.py
@@ -7,9 +7,11 @@
import hashlib
import os
+import platform
+import stat
import subprocess
+import sys
import urllib2
-import stat
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
MOJO_DIR = os.path.abspath(os.path.join(THIS_DIR, '../../third_party/externals/mojo'))
@@ -28,6 +30,7 @@ def GetFile(filename, bucket_directory):
if sha1hash(filename) == sha:
return
url = 'https://storage.googleapis.com/%s/%s' % (bucket_directory, sha)
+ print url
mtklein 2016/02/03 20:59:34 leftover debugging?
hal.canary 2016/02/03 21:23:42 fixed.
with open(filename, 'w') as o:
o.write(urllib2.urlopen(url).read())
os.chmod(filename, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
@@ -35,9 +38,16 @@ def GetFile(filename, bucket_directory):
assert sha1hash(filename) == sha
def GenerateBindings(path, cdir=None):
- GetFile(os.path.join(MOJO_DIR,
- 'public/tools/bindings/mojom_parser/bin/linux64/mojom_parser'),
- 'mojo/mojom_parser/linux64')
+ system = (platform.machine(), platform.system())
+ if ('x86_64', 'Darwin') == system:
+ parser = 'public/tools/bindings/mojom_parser/bin/mac64/mojom_parser'
+ bucket_directory = 'mojo/mojom_parser/mac64'
+ elif ('x86_64', 'Linux') == system:
+ parser = 'public/tools/bindings/mojom_parser/bin/linux64/mojom_parser'
+ bucket_directory = 'mojo/mojom_parser/linux64'
+ else:
+ assert False
+ GetFile(os.path.join(MOJO_DIR, parser), bucket_directory)
assert os.path.isfile(path)
path = os.path.abspath(path)
exe = os.path.join(
@@ -51,12 +61,15 @@ def GenerateBindings(path, cdir=None):
subprocess.check_call([exe, os.path.relpath(path, cdir)])
os.chdir(cwd)
-for f in [
- 'public/interfaces/bindings/interface_control_messages.mojom',
- 'public/interfaces/application/service_provider.mojom',
- 'public/interfaces/bindings/tests/ping_service.mojom',
- 'public/interfaces/application/application.mojom',
- ]:
- GenerateBindings(os.path.join(MOJO_DIR, f), os.path.join(MOJO_DIR, os.pardir))
-
-GenerateBindings(os.path.join(THIS_DIR, 'SkMojo.mojom'))
+if __name__ == '__main__':
+ if 1 == len(sys.argv):
+ for f in [
+ 'public/interfaces/bindings/interface_control_messages.mojom',
+ 'public/interfaces/application/service_provider.mojom',
+ 'public/interfaces/bindings/tests/ping_service.mojom',
+ 'public/interfaces/application/application.mojom',
+ ]:
+ GenerateBindings(os.path.join(MOJO_DIR, f), os.path.join(MOJO_DIR, os.pardir))
+ else:
+ for arg in sys.argv[1:]:
+ GenerateBindings(arg)
« no previous file with comments | « no previous file | gyp/skmojo.gyp » ('j') | gyp/skmojo.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698