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

Unified Diff: pylib/gyp/common.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 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: pylib/gyp/common.py
diff --git a/pylib/gyp/common.py b/pylib/gyp/common.py
index a1e1db5f1239ff3f3aa2ef4a949f752bbad0415d..f68b87c9dafeea863d702e598258ab49d4d2260b 100644
--- a/pylib/gyp/common.py
+++ b/pylib/gyp/common.py
@@ -345,7 +345,7 @@ def WriteOnDiff(filename):
prefix=os.path.split(filename)[1] + '.gyp.',
dir=os.path.split(filename)[0])
try:
- self.tmp_file = os.fdopen(tmp_fd, 'wb')
+ self.tmp_file = os.fdopen(tmp_fd, 'w')
Nico 2016/07/29 22:22:06 doesn't this change behavior on windows?
AWhetter 2016/11/05 23:59:49 Yes but we only ever write text so I think we shou
except Exception:
# Don't leave turds behind.
os.unlink(self.tmp_path)
@@ -363,7 +363,7 @@ def WriteOnDiff(filename):
same = False
try:
same = filecmp.cmp(self.tmp_path, filename, False)
- except OSError, e:
+ except OSError as e:
if e.errno != errno.ENOENT:
raise
@@ -382,9 +382,9 @@ def WriteOnDiff(filename):
#
# No way to get the umask without setting a new one? Set a safe one
# and then set it back to the old value.
- umask = os.umask(077)
+ umask = os.umask(0o77)
os.umask(umask)
- os.chmod(self.tmp_path, 0666 & ~umask)
+ os.chmod(self.tmp_path, 0o666 & ~umask)
if sys.platform == 'win32' and os.path.exists(filename):
# NOTE: on windows (but not cygwin) rename will not replace an
# existing file, so it must be preceded with a remove. Sadly there
@@ -467,7 +467,7 @@ def CopyTool(flavor, out_path, generator_flags={}):
''.join([source[0], header] + source[1:]))
# Make file executable.
- os.chmod(tool_path, 0755)
+ os.chmod(tool_path, 0o755)
# From Alex Martelli,

Powered by Google App Engine
This is Rietveld 408576698