OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 | 8 |
9 Calulate differences between image pairs, and store them in a database. | 9 Calulate differences between image pairs, and store them in a database. |
10 """ | 10 """ |
11 | 11 |
12 # System-level imports | 12 # System-level imports |
13 import contextlib | 13 import contextlib |
14 import errno | 14 import errno |
15 import json | 15 import json |
16 import logging | 16 import logging |
17 import os | 17 import os |
18 import Queue | 18 import Queue |
19 import re | 19 import re |
20 import shutil | 20 import shutil |
21 import tempfile | 21 import tempfile |
22 import threading | 22 import threading |
23 import time | 23 import time |
24 import urllib | 24 import urllib |
25 | 25 |
26 # Must fix up PYTHONPATH before importing from within Skia | 26 # Must fix up PYTHONPATH before importing from within Skia |
27 import fix_pythonpath # pylint: disable=W0611 | 27 import rs_fixpypath # pylint: disable=W0611 |
28 | 28 |
29 # Imports from within Skia | 29 # Imports from within Skia |
30 import find_run_binary | 30 import find_run_binary |
31 from py.utils import gs_utils | 31 from py.utils import gs_utils |
32 | 32 |
33 | 33 |
34 SKPDIFF_BINARY = find_run_binary.find_path_to_program('skpdiff') | 34 SKPDIFF_BINARY = find_run_binary.find_path_to_program('skpdiff') |
35 | 35 |
36 DEFAULT_IMAGE_SUFFIX = '.png' | 36 DEFAULT_IMAGE_SUFFIX = '.png' |
37 DEFAULT_IMAGES_SUBDIR = 'images' | 37 DEFAULT_IMAGES_SUBDIR = 'images' |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 468 |
469 Args: | 469 Args: |
470 locator: string, or something that can be represented as a string. | 470 locator: string, or something that can be represented as a string. |
471 If None or '', it is returned without modification, because empty | 471 If None or '', it is returned without modification, because empty |
472 locators have a particular meaning ("there is no image for this") | 472 locators have a particular meaning ("there is no image for this") |
473 """ | 473 """ |
474 if locator: | 474 if locator: |
475 return DISALLOWED_FILEPATH_CHAR_REGEX.sub('_', str(locator)) | 475 return DISALLOWED_FILEPATH_CHAR_REGEX.sub('_', str(locator)) |
476 else: | 476 else: |
477 return locator | 477 return locator |
OLD | NEW |