| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 return dest_path.replace(self._webkit_root, '') | 431 return dest_path.replace(self._webkit_root, '') |
| 432 | 432 |
| 433 @staticmethod | 433 @staticmethod |
| 434 def should_try_to_convert(file_to_copy, source_path, dest_dir): | 434 def should_try_to_convert(file_to_copy, source_path, dest_dir): |
| 435 """Checks whether we should try to modify the file when importing.""" | 435 """Checks whether we should try to modify the file when importing.""" |
| 436 if file_to_copy.get('is_jstest', False): | 436 if file_to_copy.get('is_jstest', False): |
| 437 return False | 437 return False |
| 438 | 438 |
| 439 # Conversion is not necessary for any tests in wpt now; see http://crbug
.com/654081. | 439 # Conversion is not necessary for any tests in wpt now; see http://crbug
.com/654081. |
| 440 # Note, we want to move away from converting files, see http://crbug.com
/663773. | 440 # Note, we want to move away from converting files, see http://crbug.com
/663773. |
| 441 if re.search(r'[/\\]imported[/\\]wpt[/\\]', dest_dir): | 441 if re.search(r'[/\\]external[/\\]wpt[/\\]', dest_dir): |
| 442 return False | 442 return False |
| 443 | 443 |
| 444 # Only HTML, XHTML and CSS files should be converted. | 444 # Only HTML, XHTML and CSS files should be converted. |
| 445 mimetype, _ = mimetypes.guess_type(source_path) | 445 mimetype, _ = mimetypes.guess_type(source_path) |
| 446 return mimetype in ('text/html', 'application/xhtml+xml', 'text/css') | 446 return mimetype in ('text/html', 'application/xhtml+xml', 'text/css') |
| 447 | 447 |
| 448 def path_too_long(self, source_path): | 448 def path_too_long(self, source_path): |
| 449 """Checks whether a source path is too long to import. | 449 """Checks whether a source path is too long to import. |
| 450 | 450 |
| 451 Args: | 451 Args: |
| 452 Absolute path of file to be imported. | 452 Absolute path of file to be imported. |
| 453 | 453 |
| 454 Returns: | 454 Returns: |
| 455 True if the path is too long to import, False if it's OK. | 455 True if the path is too long to import, False if it's OK. |
| 456 """ | 456 """ |
| 457 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) | 457 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) |
| 458 return len(path_from_repo_base) > MAX_PATH_LENGTH | 458 return len(path_from_repo_base) > MAX_PATH_LENGTH |
| OLD | NEW |