Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert all changes made to tools/gyp
  • Loading branch information
cclauss committed Jul 5, 2019
commit b6fe03ee437d4b0d17180f905c54aa2ae829b367
5 changes: 0 additions & 5 deletions tools/gyp/pylib/gyp/MSVSNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
import md5
_new_md5 = md5.new

try:
cmp
except NameError: # Python 3
def cmp(x, y):
return (x > y) - (x < y)

# Initialize random number generator
random.seed()
Expand Down
30 changes: 14 additions & 16 deletions tools/gyp/pylib/gyp/MSVSSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
The MSBuild schemas were also considered. They are typically found in the
MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
"""
from __future__ import print_function

import sys
import re
from six import string_types

# Dictionaries of settings validators. The key is the tool name, the value is
# a dictionary mapping setting names to validation functions.
Expand Down Expand Up @@ -108,11 +106,11 @@ class _String(_Type):
"""A setting that's just a string."""

def ValidateMSVS(self, value):
if not isinstance(value, string_types):
if not isinstance(value, basestring):
raise ValueError('expected string; got %r' % value)

def ValidateMSBuild(self, value):
if not isinstance(value, string_types):
if not isinstance(value, basestring):
raise ValueError('expected string; got %r' % value)

def ConvertToMSBuild(self, value):
Expand All @@ -124,11 +122,11 @@ class _StringList(_Type):
"""A settings that's a list of strings."""

def ValidateMSVS(self, value):
if not isinstance(value, string_types) and not isinstance(value, list):
if not isinstance(value, basestring) and not isinstance(value, list):
raise ValueError('expected string list; got %r' % value)

def ValidateMSBuild(self, value):
if not isinstance(value, string_types) and not isinstance(value, list):
if not isinstance(value, basestring) and not isinstance(value, list):
raise ValueError('expected string list; got %r' % value)

def ConvertToMSBuild(self, value):
Expand Down Expand Up @@ -402,7 +400,7 @@ def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr):

if unrecognized:
# We don't know this setting. Give a warning.
print(error_msg, file=stderr)
print >> stderr, error_msg


def FixVCMacroSlashes(s):
Expand Down Expand Up @@ -463,9 +461,9 @@ def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
# Invoke the translation function.
try:
msvs_tool[msvs_setting](msvs_value, msbuild_settings)
except ValueError as e:
print(('Warning: while converting %s/%s to MSBuild, '
'%s' % (msvs_tool_name, msvs_setting, e)), file=stderr)
except ValueError, e:
print >> stderr, ('Warning: while converting %s/%s to MSBuild, '
'%s' % (msvs_tool_name, msvs_setting, e))
else:
_ValidateExclusionSetting(msvs_setting,
msvs_tool,
Expand All @@ -474,8 +472,8 @@ def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
(msvs_tool_name, msvs_setting)),
stderr)
else:
print(('Warning: unrecognized tool %s while converting to '
'MSBuild.' % msvs_tool_name), file=stderr)
print >> stderr, ('Warning: unrecognized tool %s while converting to '
'MSBuild.' % msvs_tool_name)
return msbuild_settings


Expand Down Expand Up @@ -519,9 +517,9 @@ def _ValidateSettings(validators, settings, stderr):
if setting in tool_validators:
try:
tool_validators[setting](value)
except ValueError as e:
print(('Warning: for %s/%s, %s' %
(tool_name, setting, e)), file=stderr)
except ValueError, e:
print >> stderr, ('Warning: for %s/%s, %s' %
(tool_name, setting, e))
else:
_ValidateExclusionSetting(setting,
tool_validators,
Expand All @@ -530,7 +528,7 @@ def _ValidateSettings(validators, settings, stderr):
stderr)

else:
print(('Warning: unrecognized tool %s' % tool_name), file=stderr)
print >> stderr, ('Warning: unrecognized tool %s' % tool_name)


# MSVS and MBuild names of the tools.
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/MSVSVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _RegistryQuery(key, value=None):
text = None
try:
text = _RegistryQueryBase('Sysnative', key, value)
except OSError as e:
except OSError, e:
if e.errno == errno.ENOENT:
text = _RegistryQueryBase('System32', key, value)
else:
Expand Down
27 changes: 12 additions & 15 deletions tools/gyp/pylib/gyp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from __future__ import print_function
import copy
import gyp.input
import optparse
Expand All @@ -14,8 +13,6 @@
import sys
import traceback
from gyp.common import GypError
from six import iteritems, string_types
from six.moves import xrange

# Default debug modes for GYP
debug = {}
Expand All @@ -33,12 +30,12 @@ def DebugOutput(mode, message, *args):
f = traceback.extract_stack(limit=2)
if f:
ctx = f[0][:3]
except Exception:
except:
pass
if args:
message %= args
print('%s:%s:%d:%s %s' % (mode.upper(), os.path.basename(ctx[0]),
ctx[1], ctx[2], message))
print '%s:%s:%d:%s %s' % (mode.upper(), os.path.basename(ctx[0]),
ctx[1], ctx[2], message)

def FindBuildFiles():
extension = '.gyp'
Expand Down Expand Up @@ -210,7 +207,7 @@ def Noop(value):
# We always want to ignore the environment when regenerating, to avoid
# duplicate or changed flags in the environment at the time of regeneration.
flags = ['--ignore-environment']
for name, metadata in iteritems(options._regeneration_metadata):
for name, metadata in options._regeneration_metadata.iteritems():
opt = metadata['opt']
value = getattr(options, name)
value_predicate = metadata['type'] == 'path' and FixPath or Noop
Expand All @@ -229,12 +226,12 @@ def Noop(value):
(action == 'store_false' and not value)):
flags.append(opt)
elif options.use_environment and env_name:
print('Warning: environment regeneration unimplemented '
'for %s flag %r env_name %r' % (action, opt, env_name),
file=sys.stderr)
print >>sys.stderr, ('Warning: environment regeneration unimplemented '
'for %s flag %r env_name %r' % (action, opt,
env_name))
else:
print('Warning: regeneration unimplemented for action %r '
'flag %r' % (action, opt), file=sys.stderr)
print >>sys.stderr, ('Warning: regeneration unimplemented for action %r '
'flag %r' % (action, opt))

return flags

Expand Down Expand Up @@ -413,7 +410,7 @@ def gyp_main(args):
for option, value in sorted(options.__dict__.items()):
if option[0] == '_':
continue
if isinstance(value, string_types):
if isinstance(value, basestring):
DebugOutput(DEBUG_GENERAL, " %s: '%s'", option, value)
else:
DebugOutput(DEBUG_GENERAL, " %s: %s", option, value)
Expand Down Expand Up @@ -478,7 +475,7 @@ def gyp_main(args):
if home_dot_gyp != None:
default_include = os.path.join(home_dot_gyp, 'include.gypi')
if os.path.exists(default_include):
print('Using overrides found in ' + default_include)
print 'Using overrides found in ' + default_include
includes.append(default_include)

# Command-line --include files come after the default include.
Expand Down Expand Up @@ -539,7 +536,7 @@ def gyp_main(args):
def main(args):
try:
return gyp_main(args)
except GypError as e:
except GypError, e:
sys.stderr.write("gyp: %s\n" % e)
return 1

Expand Down
8 changes: 4 additions & 4 deletions tools/gyp/pylib/gyp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def close(self):
same = False
try:
same = filecmp.cmp(self.tmp_path, filename, False)
except OSError as e:
except OSError, e:
if e.errno != errno.ENOENT:
raise

Expand All @@ -382,9 +382,9 @@ def close(self):
#
# 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(0o77)
umask = os.umask(077)
os.umask(umask)
os.chmod(self.tmp_path, 0o666 & ~umask)
os.chmod(self.tmp_path, 0666 & ~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
Expand Down Expand Up @@ -467,7 +467,7 @@ def CopyTool(flavor, out_path, generator_flags={}):
''.join([source[0], header] + source[1:]))

# Make file executable.
os.chmod(tool_path, 0o755)
os.chmod(tool_path, 0755)


# From Alex Martelli,
Expand Down
1 change: 0 additions & 1 deletion tools/gyp/pylib/gyp/easy_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re
import os
import locale
from functools import reduce


def XmlToString(content, encoding='utf-8', pretty=False):
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/flock_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def ExecFlock(self, lockfile, *cmd_list):
# where fcntl.flock(fd, LOCK_EX) always fails
# with EBADF, that's why we use this F_SETLK
# hack instead.
fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666)
if sys.platform.startswith('aix'):
# Python on AIX is compiled with LARGEFILE support, which changes the
# struct size.
Expand Down
Loading