OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright 2016 Google Inc. | 3 # Copyright 2016 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 | 8 |
9 """ | 9 """ |
10 Script to build the command buffer shared library and copy it to Skia tree | 10 Script to build the command buffer shared library and copy it to Skia tree |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 shared_lib_subdir = '' | 104 shared_lib_subdir = '' |
105 elif platform == 'win32': | 105 elif platform == 'win32': |
106 shared_lib_name = 'command_buffer_gles2.dll' | 106 shared_lib_name = 'command_buffer_gles2.dll' |
107 shared_lib_subdir = '' | 107 shared_lib_subdir = '' |
108 gclient = 'gclient.bat' | 108 gclient = 'gclient.bat' |
109 | 109 |
110 if not args.no_sync: | 110 if not args.no_sync: |
111 try: | 111 try: |
112 subprocess.check_call(['git', 'fetch'], cwd=chrome_src_dir) | 112 subprocess.check_call(['git', 'fetch'], cwd=chrome_src_dir) |
113 except subprocess.CalledProcessError as error: | 113 except subprocess.CalledProcessError as error: |
114 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, | 114 sys.exit('Error (ret code: %s) calling "%s" in %s' % (error.returncode, |
115 error.cmd, chrome_src_dir) | 115 error.cmd, chrome_src_dir)) |
116 | 116 |
117 try: | 117 try: |
118 subprocess.check_call(['git', 'checkout', args.chrome_revision], | 118 subprocess.check_call(['git', 'checkout', args.chrome_revision], |
119 cwd=chrome_src_dir) | 119 cwd=chrome_src_dir) |
120 except subprocess.CalledProcessError as error: | 120 except subprocess.CalledProcessError as error: |
121 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, | 121 sys.exit('Error (ret code: %s) calling "%s" in %s' % (error.returncode, |
122 error.cmd, chrome_src_dir) | 122 error.cmd, chrome_src_dir)) |
123 | 123 |
124 if not args.no_sync: | 124 if not args.no_sync: |
125 try: | 125 try: |
126 os.environ['GYP_GENERATORS'] = 'ninja' | 126 os.environ['GYP_GENERATORS'] = 'ninja' |
127 subprocess.check_call([gclient, 'sync', '--reset', '--force'], | 127 subprocess.check_call([gclient, 'sync', '--reset', '--force'], |
128 cwd=chrome_src_dir) | 128 cwd=chrome_src_dir) |
129 except subprocess.CalledProcessError as error: | 129 except subprocess.CalledProcessError as error: |
130 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, | 130 sys.exit('Error (ret code: %s) calling "%s" in %s' % (error.returncode, |
131 error.cmd, chrome_src_dir) | 131 error.cmd, chrome_src_dir)) |
132 | 132 |
133 try: | 133 try: |
134 subprocess.check_call(['ninja'] + shlex.split(args.extra_ninja_args) + | 134 subprocess.check_call(['ninja'] + shlex.split(args.extra_ninja_args) + |
135 ['-C', chrome_target_dir_rel, 'command_buffer_gles2'], | 135 ['-C', chrome_target_dir_rel, 'command_buffer_gles2'], |
136 cwd=chrome_src_dir) | 136 cwd=chrome_src_dir) |
137 except subprocess.CalledProcessError as error: | 137 except subprocess.CalledProcessError as error: |
138 sys.exit('Error (ret code: %s) calling "%s" in %s' % error.returncode, | 138 sys.exit('Error (ret code: %s) calling "%s" in %s' % (error.returncode, |
139 error.cmd, chrome_src_dir) | 139 error.cmd, chrome_src_dir)) |
140 | 140 |
141 shared_lib_src_dir = os.path.join(chrome_src_dir, chrome_target_dir_rel, | 141 shared_lib_src_dir = os.path.join(chrome_src_dir, chrome_target_dir_rel, |
142 shared_lib_subdir) | 142 shared_lib_subdir) |
143 shared_lib_dst_dir = os.path.join(args.output_dir, shared_lib_subdir) | 143 shared_lib_dst_dir = os.path.join(args.output_dir, shared_lib_subdir) |
144 # Make the subdir for the dst if does not exist | 144 # Make the subdir for the dst if does not exist |
145 if shared_lib_subdir and not os.path.isdir(shared_lib_dst_dir): | 145 if shared_lib_subdir and not os.path.isdir(shared_lib_dst_dir): |
146 os.mkdir(shared_lib_dst_dir) | 146 os.mkdir(shared_lib_dst_dir) |
147 | 147 |
148 shared_lib_src = os.path.join(shared_lib_src_dir, shared_lib_name) | 148 shared_lib_src = os.path.join(shared_lib_src_dir, shared_lib_name) |
149 shared_lib_dst = os.path.join(shared_lib_dst_dir, shared_lib_name) | 149 shared_lib_dst = os.path.join(shared_lib_dst_dir, shared_lib_name) |
150 | 150 |
151 if not os.path.isfile(shared_lib_src): | 151 if not os.path.isfile(shared_lib_src): |
152 sys.exit('Command buffer shared library not at expected location: ' + | 152 sys.exit('Command buffer shared library not at expected location: ' + |
153 shared_lib_src) | 153 shared_lib_src) |
154 | 154 |
155 shutil.copy2(shared_lib_src, shared_lib_dst) | 155 shutil.copy2(shared_lib_src, shared_lib_dst) |
156 | 156 |
157 if not os.path.isfile(shared_lib_dst): | 157 if not os.path.isfile(shared_lib_dst): |
158 sys.exit('Command buffer library not copied to ' + shared_lib_dst) | 158 sys.exit('Command buffer library not copied to ' + shared_lib_dst) |
159 | 159 |
160 print('Command buffer library copied to ' + shared_lib_dst) | 160 print('Command buffer library copied to ' + shared_lib_dst) |
161 | 161 |
162 | 162 |
163 if __name__ == '__main__': | 163 if __name__ == '__main__': |
164 main() | 164 main() |
165 | 165 |
OLD | NEW |