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

Unified Diff: third_party/WebKit/Source/bindings/scripts/utilities.py

Issue 2367303002: [Bindings] Remove a redundant option write-file-if-only-changed in bindings (Closed)
Patch Set: Rebase Created 4 years, 3 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
Index: third_party/WebKit/Source/bindings/scripts/utilities.py
diff --git a/third_party/WebKit/Source/bindings/scripts/utilities.py b/third_party/WebKit/Source/bindings/scripts/utilities.py
index a9871f6d5dbaadb36b42d32591fd62dcd173ce11..ab37173143b8f3f2def2e19864cf14927d9e9694 100644
--- a/third_party/WebKit/Source/bindings/scripts/utilities.py
+++ b/third_party/WebKit/Source/bindings/scripts/utilities.py
@@ -303,11 +303,13 @@ def read_pickle_files(pickle_filenames):
yield pickle.load(pickle_file)
-def write_file(new_text, destination_filename, only_if_changed):
- if only_if_changed and os.path.isfile(destination_filename):
+def write_file(new_text, destination_filename):
+ # If |new_text| is same with the file content, we skip updating.
+ if os.path.isfile(destination_filename):
with open(destination_filename) as destination_file:
if destination_file.read() == new_text:
return
+
destination_dirname = os.path.dirname(destination_filename)
if not os.path.exists(destination_dirname):
os.makedirs(destination_dirname)
@@ -315,8 +317,9 @@ def write_file(new_text, destination_filename, only_if_changed):
destination_file.write(new_text)
-def write_pickle_file(pickle_filename, data, only_if_changed):
- if only_if_changed and os.path.isfile(pickle_filename):
+def write_pickle_file(pickle_filename, data):
+ # If |data| is same with the file content, we skip updating.
+ if os.path.isfile(pickle_filename):
with open(pickle_filename) as pickle_file:
try:
if pickle.load(pickle_file) == data:

Powered by Google App Engine
This is Rietveld 408576698