Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: Source/devtools/scripts/devtools_file_hashes.py

Issue 662393004: DevTools: scripts: remove manual path concatenation / splitting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/PRESUBMIT.py ('k') | Source/devtools/scripts/optimize_png_images.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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)
« no previous file with comments | « Source/devtools/PRESUBMIT.py ('k') | Source/devtools/scripts/optimize_png_images.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698