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
Next Next commit
build: find Python 3 or Python 2 in configure
  • Loading branch information
cclauss committed Jul 5, 2019
commit ca8b7b4a8d28d67910349678160020074d408f38
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
install: *ccache-setup-steps
script:
- pyenv global 2.7.15
- pip install --upgrade pip
- pip install six
Comment thread
cclauss marked this conversation as resolved.
Outdated
- ./configure
- make -j2 -C out V=1 v8

Expand All @@ -35,6 +37,8 @@ jobs:
install: *ccache-setup-steps
script:
- pyenv global 2.7.15
- pip install --upgrade pip
- pip install six
- ./configure
- make -j2 V=1
- cp out/Release/node /home/travis/.ccache
Expand All @@ -48,6 +52,8 @@ jobs:
- cp /home/travis/.ccache/node out/Release/node
script:
- pyenv global 2.7.15
- pip install --upgrade pip
- pip install six
- python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare default

- name: "Test C++ Suites"
Expand All @@ -64,6 +70,8 @@ jobs:
- touch config.gypi
script:
- pyenv global 2.7.15
- pip install --upgrade pip
- pip install six
- out/Release/cctest
- make -j1 V=1 test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp
- python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare addons js-native-api node-api
Expand All @@ -73,6 +81,8 @@ jobs:
node_js: "node"
install:
- pyenv global 2.7.15
- pip install --upgrade pip
- pip install six
- make lint-py-build || true
script:
- NODE=$(which node) make lint lint-py
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ if sys.version_info[:2] != (2, 7):
sys.stderr.write('\n')
sys.exit(1)

import configure
import configure
Comment thread
cclauss marked this conversation as resolved.
Outdated
13 changes: 6 additions & 7 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import shlex
import subprocess
import shutil
import string
from distutils.spawn import find_executable as which

# If not run from node/, cd to node/.
Expand Down Expand Up @@ -675,8 +674,8 @@ def try_check_compiler(cc, lang):
except OSError:
return (False, False, '', '')

proc.stdin.write('__clang__ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ '
'__clang_major__ __clang_minor__ __clang_patchlevel__')
proc.stdin.write(b'__clang__ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ '
b'__clang_major__ __clang_minor__ __clang_patchlevel__')

values = (proc.communicate()[0].split() + ['0'] * 7)[0:7]
is_clang = values[0] == '1'
Expand Down Expand Up @@ -754,10 +753,10 @@ def get_gas_version(cc):
it in a non-standard prefix.''')

gas_ret = proc.communicate()[1]
match = re.match(r"GNU assembler version ([2-9]\.[0-9]+)", gas_ret)
match = re.match(b"GNU assembler version ([2-9]\.[0-9]+)", gas_ret)

if match:
return match.group(1)
return str(float(match.group(1)))
else:
warn('Could not recognize `gas`: ' + gas_ret)
return '0'
Expand Down Expand Up @@ -818,7 +817,7 @@ def cc_macros(cc=None):
consider adjusting the CC environment variable if you installed
it in a non-standard prefix.''')

p.stdin.write('\n')
p.stdin.write(b'\n')
out = p.communicate()[0]

out = str(out).split('\n')
Expand Down Expand Up @@ -1380,7 +1379,7 @@ def write_config(data, name):
o['variables']['icu_small'] = b(True)
locs = set(options.with_icu_locales.split(','))
locs.add('root') # must have root
o['variables']['icu_locales'] = string.join(locs,',')
o['variables']['icu_locales'] = ','.join(str(loc) for loc in locs)
# We will check a bit later if we can use the canned deps/icu-small
elif with_intl == 'full-icu':
# full ICU
Expand Down
15 changes: 12 additions & 3 deletions deps/v8/third_party/inspector_protocol/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,24 @@ def init_defaults(config_tuple, path, defaults):
jinja_dir = arg_options.jinja_dir
if not jinja_dir:
raise Exception("jinja directory must be specified")
jinja_dir = jinja_dir.decode('utf8')
try:
jinja_dir = jinja_dir.decode('utf8')
except AttributeError: # Python 3
pass
output_base = arg_options.output_base
if not output_base:
raise Exception("Base output directory must be specified")
output_base = output_base.decode('utf8')
try:
output_base = output_base.decode('utf8')
except AttributeError: # Python 3
pass
config_file = arg_options.config
if not config_file:
raise Exception("Config file name must be specified")
config_file = config_file.decode('utf8')
try:
config_file = config_file.decode('utf8')
except AttributeError: # Python 3
pass
config_base = os.path.dirname(config_file)
config_values = arg_options.config_value
if not config_values:
Expand Down
8 changes: 2 additions & 6 deletions deps/v8/tools/gen-postmortem-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,7 @@ def emit_config():

out.write('/* class type information */\n');
consts = [];
keys = typeclasses.keys();
keys.sort();
for typename in keys:
for typename in sorted(typeclasses):
klass = typeclasses[typename];
consts.append({
'name': 'type_%s__%s' % (klass, typename),
Expand All @@ -649,9 +647,7 @@ def emit_config():

out.write('/* class hierarchy information */\n');
consts = [];
keys = klasses.keys();
keys.sort();
for klassname in keys:
for klassname in sorted(klasses):
pklass = klasses[klassname]['parent'];
bklass = get_base_class(klassname);
if (bklass != 'Object'):
Expand Down
10 changes: 5 additions & 5 deletions tools/configure.d/nodedownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
# Moved some utilities here from ../../configure

from __future__ import print_function
import urllib
import hashlib
import sys
import zipfile
import tarfile
import fpformat
import contextlib
from six.moves.urllib.request import FancyURLopener, URLopener

def formatSize(amt):
"""Format a size as a string in MB"""
return fpformat.fix(amt / 1024000., 1)
# return fpformat.fix(amt / 1024000., 1)
return "%.1f" % (amt / 1024000.)

def spin(c):
"""print out an ASCII 'spinner' based on the value of counter 'c'"""
spin = ".:|'"
return (spin[c % len(spin)])

class ConfigOpener(urllib.FancyURLopener):
class ConfigOpener(FancyURLopener):
"""fancy opener used by retrievefile. Set a UA"""
# append to existing version (UA)
version = '%s node.js/configure' % urllib.URLopener.version
version = '%s node.js/configure' % URLopener.version

def reporthook(count, size, total):
"""internal hook used by retrievefile"""
Expand Down
5 changes: 5 additions & 0 deletions tools/gyp/pylib/gyp/MSVSNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
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: 16 additions & 14 deletions tools/gyp/pylib/gyp/MSVSSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
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 @@ -106,11 +108,11 @@ class _String(_Type):
"""A setting that's just a string."""

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

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

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

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

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

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

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


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


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

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


# 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, e:
except OSError as e:
if e.errno == errno.ENOENT:
text = _RegistryQueryBase('System32', key, value)
else:
Expand Down
27 changes: 15 additions & 12 deletions tools/gyp/pylib/gyp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# 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 @@ -13,6 +14,8 @@
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 @@ -30,12 +33,12 @@ def DebugOutput(mode, message, *args):
f = traceback.extract_stack(limit=2)
if f:
ctx = f[0][:3]
except:
except Exception:
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 @@ -207,7 +210,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 options._regeneration_metadata.iteritems():
for name, metadata in iteritems(options._regeneration_metadata):
opt = metadata['opt']
value = getattr(options, name)
value_predicate = metadata['type'] == 'path' and FixPath or Noop
Expand All @@ -226,12 +229,12 @@ def Noop(value):
(action == 'store_false' and not value)):
flags.append(opt)
elif options.use_environment and env_name:
print >>sys.stderr, ('Warning: environment regeneration unimplemented '
'for %s flag %r env_name %r' % (action, opt,
env_name))
print('Warning: environment regeneration unimplemented '
'for %s flag %r env_name %r' % (action, opt, env_name),
file=sys.stderr)
else:
print >>sys.stderr, ('Warning: regeneration unimplemented for action %r '
'flag %r' % (action, opt))
print('Warning: regeneration unimplemented for action %r '
'flag %r' % (action, opt), file=sys.stderr)

return flags

Expand Down Expand Up @@ -410,7 +413,7 @@ def gyp_main(args):
for option, value in sorted(options.__dict__.items()):
if option[0] == '_':
continue
if isinstance(value, basestring):
if isinstance(value, string_types):
DebugOutput(DEBUG_GENERAL, " %s: '%s'", option, value)
else:
DebugOutput(DEBUG_GENERAL, " %s: %s", option, value)
Expand Down Expand Up @@ -475,7 +478,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 @@ -536,7 +539,7 @@ def gyp_main(args):
def main(args):
try:
return gyp_main(args)
except GypError, e:
except GypError as e:
sys.stderr.write("gyp: %s\n" % e)
return 1

Expand Down
Loading