Chromium Code Reviews| Index: Source/devtools/scripts/devtools_file_hashes.py |
| diff --git a/Source/devtools/scripts/devtools_file_hashes.py b/Source/devtools/scripts/devtools_file_hashes.py |
| old mode 100644 |
| new mode 100755 |
| index 6eaefcb4a3f61e8b3fedd71e600347b16fc2765e..8c67f1cf86b325b84481899090effab28aa969aa |
| --- a/Source/devtools/scripts/devtools_file_hashes.py |
| +++ b/Source/devtools/scripts/devtools_file_hashes.py |
| @@ -28,7 +28,7 @@ |
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| import hashlib |
| -import re |
| +import os.path |
|
apavlov
2014/10/22 06:32:42
from os import path
could let you use just
path.
eustas
2014/10/22 08:08:09
Personally for me this will be less readable.
|
| try: |
| import json |
| @@ -65,7 +65,7 @@ def files_with_invalid_hashes(hash_file_path, file_paths): |
| hashes = load_hashes(hash_file_path) |
| result = [] |
| for file_path in file_paths: |
| - file_name = re.sub(".*/", "", file_path) |
| + file_name = os.path.basename(file_path) |
| if calculate_file_hash(file_path) != hashes.get(file_name, ""): |
| result.append(file_path) |
| return result |
| @@ -74,6 +74,6 @@ def files_with_invalid_hashes(hash_file_path, file_paths): |
| def update_file_hashes(hash_file_path, file_paths): |
| hashes = {} |
| for file_path in file_paths: |
| - file_name = re.sub(".*/", "", file_path) |
| + file_name = os.path.basename(file_path) |
| hashes[file_name] = calculate_file_hash(file_path) |
| save_hashes(hash_file_path, hashes) |