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

Side by Side Diff: mojo/public/sky/convert_amd_modules_to_sky.py

Issue 881093003: Normalize import paths for Sky modules (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import sys 7 import sys
8 import re 8 import re
9 9
10 IMPORT_TEMPLATE = '<import src="/%s.sky" as="%s" />' 10 IMPORT_TEMPLATE = '<import src="/gen/%s.sky" as="%s" />'
11 PREAMBLE_TEMPLATE = '<script>' 11 PREAMBLE_TEMPLATE = '<script>'
12 POSTAMBLE_TEMPLATE = ' module.exports = exports;\n</script>' 12 POSTAMBLE_TEMPLATE = ' module.exports = exports;\n</script>'
13 13
14 class Import(object): 14 class Import(object):
15 def __init__(self, path, name): 15 def __init__(self, path, name):
16 self.path = path 16 self.path = path
17 self.name = name 17 self.name = name
18 18
19 class Module(object): 19 class Module(object):
20 def __init__(self): 20 def __init__(self):
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 with open(args.input, "r") as input_file: 91 with open(args.input, "r") as input_file:
92 module = Parse(input_file.read()) 92 module = Parse(input_file.read())
93 93
94 with open(args.output, "w+") as output_file: 94 with open(args.output, "w+") as output_file:
95 output_file.write(Serialize(module)) 95 output_file.write(Serialize(module))
96 96
97 return 0 97 return 0
98 98
99 if __name__ == "__main__": 99 if __name__ == "__main__":
100 sys.exit(main()) 100 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698