158 original_cwd = os.getcwd()
160 os.makedirs(destination_dir)
162 if e.errno != errno.EEXIST:
164 os.chdir(destination_dir)
170 for (root, _, files)
in os.walk(source_dir, topdown=
False):
171 dir_portion =
subpath(root, source_dir)
175 if dir_portion != DART_SDK_GENERATOR_SCRIPTS:
176 if (f.endswith(IDL_EXT)
or f == IDL_EXTENDED_ATTRIBUTES_FILE
or
177 f.endswith(PY_EXT)
or
178 f.startswith(LICENSE_FILE_PREFIX)):
179 if f.endswith(IDL_EXT):
181 elif f.endswith(PY_EXT):
185 src_file = os.path.join(root, f)
188 subdir_root = src_file[src_file.rfind(src_prefix) +
190 if subdir_root.startswith(os.path.sep):
191 subdir_root = subdir_root[1:]
192 dst_file = os.path.join(destination_dir, subdir_root)
196 destination = os.path.dirname(dst_file)
197 if not os.path.exists(destination):
198 os.makedirs(destination)
203 copyfile(src_file, dst_file)
206 print(
'...copying %s' % dst_file)
207 if f == IDL_EXTENDED_ATTRIBUTES_FILE:
208 warning_messages.append(dst_file)
211 warning_messages.append(dst_file)
212 if not (
isDryRun()
or has_Dart_fix_me):
216 os.chdir(original_cwd)
218 return [idls, pys, others]
229 original_cwd = os.getcwd()
231 if os.path.exists(webcore_dir):
232 os.chdir(webcore_dir)
234 for (root, _, files)
in os.walk(
235 os.path.join(webcore_dir, subdir), topdown=
False):
236 dir_portion =
subpath(root, webcore_dir)
240 if dir_portion != DART_SDK_GENERATOR_SCRIPTS:
241 check_file = os.path.join(dir_portion, f)
242 check_file_full_path = os.path.join(webkit_dir, check_file)
243 if not os.path.exists(check_file_full_path)
and \
244 not(check_file_full_path.endswith(PYTHON_INITS)):
248 files_to_delete.append(check_file)
250 os.chdir(original_cwd)
252 return files_to_delete
358 print(
"%s files removed in WebCore %s" % (idls_deleted.__len__(), subdir))
360 for delete_file
in idls_deleted:
361 print(
" %s" % delete_file)
363 idls_copied, py_copied, other_copied =
copy_files(
364 os.path.join(src, subdir), src_prefix, dest)
366 print(
"Copied %s IDLs to %s" % (idls_copied, subdir))
368 print(
"Copied %s PYs to %s" % (py_copied, subdir))
370 print(
"Copied %s other to %s\n" % (other_copied, subdir))
377 current_dir = os.path.dirname(os.path.abspath(__file__))
378 if not current_dir.endswith(SOURCE_FILE_DIR):
379 print(
'ERROR: idlsync.py not run in proper directory (%s)\n',
382 base_directory = current_dir[:current_dir.rfind(SOURCE_FILE_DIR)]
388 if webcore_revision == chromium_sha:
389 print(
"ERROR: Nothing to update in WebCore, WebCore_rev SHA in DEPS "
390 "matches Chromium GIT master SHA in %s" % options[
'webkit_dir'])
393 start_time = time.time()
411 webcore_blink_dir = os.path.join(base_directory, WEBCORE_BLINK_SOURCE)
412 copy_subdir(webkit_blink_dir, WEBKIT_BLINK_SOURCE, webcore_blink_dir,
"")
415 dart_webcore_dir = os.path.join(base_directory, WEBCORE_SOURCE)
416 for subdir
in SUBDIRS:
417 copy_subdir(chromium_webkit_dir, WEBKIT_SOURCE, dart_webcore_dir,
420 end_time = time.time()
423 'WARNING: File(s) contain FIXMEDART and are NOT "git add " please review:'
425 for warning
in warning_messages:
426 print(
' %s' % warning)
428 print(
'\nDone idlsync completed in %s seconds' %
429 round(end_time - start_time, 2))