| OLD | NEW |
| 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # | 6 # |
| 7 # 1. Redistributions of source code must retain the above | 7 # 1. Redistributions of source code must retain the above |
| 8 # copyright notice, this list of conditions and the following | 8 # copyright notice, this list of conditions and the following |
| 9 # disclaimer. | 9 # disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above | 10 # 2. Redistributions in binary form must reproduce the above |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 else: | 227 else: |
| 228 continue | 228 continue |
| 229 # FIXME: This block should really be a separate function, but th
e early-continues make that difficult. | 229 # FIXME: This block should really be a separate function, but th
e early-continues make that difficult. |
| 230 | 230 |
| 231 if filename.startswith('.') or filename.endswith('.pl'): | 231 if filename.startswith('.') or filename.endswith('.pl'): |
| 232 continue # For some reason the w3c repo contains random per
l scripts we don't care about. | 232 continue # For some reason the w3c repo contains random per
l scripts we don't care about. |
| 233 | 233 |
| 234 fullpath = self.filesystem.join(root, filename) | 234 fullpath = self.filesystem.join(root, filename) |
| 235 | 235 |
| 236 mimetype = mimetypes.guess_type(fullpath) | 236 mimetype = mimetypes.guess_type(fullpath) |
| 237 if not 'html' in str(mimetype[0]) and not 'application/xhtml+xml
' in str(mimetype[0]) and not 'application/xml' in str(mimetype[0]): | 237 if ('html' not in str(mimetype[0]) and |
| 238 'application/xhtml+xml' not in str(mimetype[0]) and |
| 239 'application/xml' not in str(mimetype[0])): |
| 238 copy_list.append({'src': fullpath, 'dest': filename}) | 240 copy_list.append({'src': fullpath, 'dest': filename}) |
| 239 continue | 241 continue |
| 240 | 242 |
| 241 if self.filesystem.basename(root) in DIRS_TO_INCLUDE: | 243 if self.filesystem.basename(root) in DIRS_TO_INCLUDE: |
| 242 copy_list.append({'src': fullpath, 'dest': filename}) | 244 copy_list.append({'src': fullpath, 'dest': filename}) |
| 243 continue | 245 continue |
| 244 | 246 |
| 245 test_parser = TestParser(vars(self.options), filename=fullpath) | 247 test_parser = TestParser(vars(self.options), filename=fullpath) |
| 246 test_info = test_parser.analyze_test() | 248 test_info = test_parser.analyze_test() |
| 247 if test_info is None: | 249 if test_info is None: |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 _log.info(' skipping %s' % relpath) | 366 _log.info(' skipping %s' % relpath) |
| 365 else: | 367 else: |
| 366 # FIXME: Maybe doing a file diff is in order here for existi
ng files? | 368 # FIXME: Maybe doing a file diff is in order here for existi
ng files? |
| 367 # In other words, there's no sense in overwriting identical
files, but | 369 # In other words, there's no sense in overwriting identical
files, but |
| 368 # there's no harm in copying the identical thing. | 370 # there's no harm in copying the identical thing. |
| 369 _log.info(' %s' % relpath) | 371 _log.info(' %s' % relpath) |
| 370 | 372 |
| 371 # Only HTML, XML, or CSS should be converted. | 373 # Only HTML, XML, or CSS should be converted. |
| 372 # FIXME: Eventually, so should JS when support is added for this
type of conversion. | 374 # FIXME: Eventually, so should JS when support is added for this
type of conversion. |
| 373 mimetype = mimetypes.guess_type(orig_filepath) | 375 mimetype = mimetypes.guess_type(orig_filepath) |
| 374 if 'is_jstest' not in file_to_copy and ('html' in str(mimetype[0
]) or 'xml' in str(mimetype[0]) or 'css' in str(mimetype[0])): | 376 if 'is_jstest' not in file_to_copy and ( |
| 377 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0])
or 'css' in str(mimetype[0])): |
| 375 converted_file = convert_for_webkit(new_path, filename=orig_
filepath, | 378 converted_file = convert_for_webkit(new_path, filename=orig_
filepath, |
| 376 reference_support_info=r
eference_support_info) | 379 reference_support_info=r
eference_support_info) |
| 377 | 380 |
| 378 if not converted_file: | 381 if not converted_file: |
| 379 if not self.import_in_place and not self.options.dry_run
: | 382 if not self.import_in_place and not self.options.dry_run
: |
| 380 self.filesystem.copyfile(orig_filepath, new_filepath
) # The file was unmodified. | 383 self.filesystem.copyfile(orig_filepath, new_filepath
) # The file was unmodified. |
| 381 else: | 384 else: |
| 382 for prefixed_property in converted_file[0]: | 385 for prefixed_property in converted_file[0]: |
| 383 total_prefixed_properties.setdefault(prefixed_proper
ty, 0) | 386 total_prefixed_properties.setdefault(prefixed_proper
ty, 0) |
| 384 total_prefixed_properties[prefixed_property] += 1 | 387 total_prefixed_properties[prefixed_property] += 1 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 409 _log.info(' %s: %s', prefixed_property, total_prefixed_properti
es[prefixed_property]) | 412 _log.info(' %s: %s', prefixed_property, total_prefixed_properti
es[prefixed_property]) |
| 410 | 413 |
| 411 def path_too_long(self, source_path): | 414 def path_too_long(self, source_path): |
| 412 """Checks whether a source path is too long to import. | 415 """Checks whether a source path is too long to import. |
| 413 | 416 |
| 414 Args: | 417 Args: |
| 415 Absolute path of file to be imported. | 418 Absolute path of file to be imported. |
| 416 """ | 419 """ |
| 417 path_from_repo_base = os.path.relpath(source_path, self.top_of_repo) | 420 path_from_repo_base = os.path.relpath(source_path, self.top_of_repo) |
| 418 return len(path_from_repo_base) > MAX_PATH_LENGTH | 421 return len(path_from_repo_base) > MAX_PATH_LENGTH |
| OLD | NEW |