Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Perrotte <mike@npmjs.com>2020-01-28 02:44:13 +0300
committerMichael Perrotte <mike@npmjs.com>2020-01-28 20:27:42 +0300
commitc9b69d569fec7944375a746e9c08a6fa9bec96ff (patch)
tree98578810736ebaed0f0e4b33c38bbcd5b411e6dd /node_modules/node-gyp/gyp
parente8dbaf452a1f6c5350bb0c37059b89a7448e7986 (diff)
node-gyp@5.0.7
Diffstat (limited to 'node_modules/node-gyp/gyp')
-rwxr-xr-xnode_modules/node-gyp/gyp/gyp_main.py2
-rwxr-xr-xnode_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py2
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py6
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/common.py8
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py5
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py6
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py6
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/generator/make.py2
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py16
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py1
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/input.py8
-rwxr-xr-xnode_modules/node-gyp/gyp/pylib/gyp/mac_tool.py4
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py10
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py289
-rwxr-xr-xnode_modules/node-gyp/gyp/pylib/gyp/win_tool.py11
-rw-r--r--node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py47
16 files changed, 88 insertions, 335 deletions
diff --git a/node_modules/node-gyp/gyp/gyp_main.py b/node_modules/node-gyp/gyp/gyp_main.py
index aece53c8e..f738e8009 100755
--- a/node_modules/node-gyp/gyp/gyp_main.py
+++ b/node_modules/node-gyp/gyp/gyp_main.py
@@ -31,7 +31,7 @@ def UnixifyPath(path):
out = subprocess.Popen(["cygpath", "-u", path],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
- stdout, stderr = out.communicate()
+ stdout, _ = out.communicate()
if PY3:
stdout = stdout.decode("utf-8")
return str(stdout)
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py b/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
index c082bbea9..ce71c38a9 100755
--- a/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
@@ -1085,6 +1085,7 @@ class TestSequenceFunctions(unittest.TestCase):
'GenerateManifest': 'true',
'IgnoreImportLibrary': 'true',
'LinkIncremental': 'false'}}
+ self.maxDiff = 9999 # on failure display a long diff
actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
msvs_settings,
self.stderr)
@@ -1476,6 +1477,7 @@ class TestSequenceFunctions(unittest.TestCase):
'ResourceOutputFileName':
'$(IntDir)$(TargetFileName).embed.manifest.resfdsf'}
}
+ self.maxDiff = 9999 # on failure display a long diff
actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
msvs_settings,
self.stderr)
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py b/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
index 13d9777f0..c7cf68d3a 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
@@ -12,6 +12,8 @@ import sys
import gyp
import glob
+PY3 = bytes != str
+
class VisualStudioVersion(object):
"""Information regarding a version of Visual Studio."""
@@ -132,6 +134,8 @@ def _RegistryQueryBase(sysdir, key, value):
# Obtain the stdout from reg.exe, reading to the end so p.returncode is valid
# Note that the error text may be in [1] in some cases
text = p.communicate()[0]
+ if PY3:
+ text = text.decode('utf-8')
# Check return code from reg.exe; officially 0==success and 1==error
if p.returncode:
return None
@@ -334,6 +338,8 @@ def _ConvertToCygpath(path):
if sys.platform == 'cygwin':
p = subprocess.Popen(['cygpath', path], stdout=subprocess.PIPE)
path = p.communicate()[0].strip()
+ if PY3:
+ path = path.decode('utf-8')
return path
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/common.py b/node_modules/node-gyp/gyp/pylib/gyp/common.py
index 071ad7e24..d866e81d4 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/common.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/common.py
@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import collections
import errno
import filecmp
import os.path
@@ -11,6 +10,11 @@ import tempfile
import sys
import subprocess
+try:
+ from collections.abc import MutableSet
+except ImportError:
+ from collections import MutableSet
+
PY3 = bytes != str
@@ -496,7 +500,7 @@ def uniquer(seq, idfun=None):
# Based on http://code.activestate.com/recipes/576694/.
-class OrderedSet(collections.MutableSet):
+class OrderedSet(MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
index 996b6f25f..5601a6657 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
@@ -239,7 +239,10 @@ def StringToCMakeTargetName(a):
Invalid for make: ':'
Invalid for unknown reasons but cause failures: '.'
"""
- return a.translate(string.maketrans(' /():."', '_______'))
+ try:
+ return a.translate(str.maketrans(' /():."', '_______'))
+ except AttributeError:
+ return a.translate(string.maketrans(' /():."', '_______'))
def WriteActions(target_name, actions, extra_sources, extra_deps,
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
index 575db63c4..1b8490451 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
@@ -43,7 +43,7 @@ def CalculateVariables(default_variables, params):
def AddCommandsForTarget(cwd, target, params, per_config_commands):
output_dir = params['generator_flags']['output_dir']
- for configuration_name, configuration in target['configurations'].iteritems():
+ for configuration_name, configuration in target['configurations'].items():
builddir_name = os.path.join(output_dir, configuration_name)
if IsMac(params):
@@ -92,7 +92,7 @@ def AddCommandsForTarget(cwd, target, params, per_config_commands):
def GenerateOutput(target_list, target_dicts, data, params):
per_config_commands = {}
- for qualified_target, target in target_dicts.iteritems():
+ for qualified_target, target in target_dicts.items():
build_file, target_name, toolset = (
gyp.common.ParseQualifiedTarget(qualified_target))
if IsMac(params):
@@ -102,7 +102,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
AddCommandsForTarget(cwd, target, params, per_config_commands)
output_dir = params['generator_flags']['output_dir']
- for configuration_name, commands in per_config_commands.iteritems():
+ for configuration_name, commands in per_config_commands.items():
filename = os.path.join(output_dir,
configuration_name,
'compile_commands.json')
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
index 6b49ad676..91f187d68 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
@@ -26,6 +26,8 @@ import gyp.msvs_emulation
import shlex
import xml.etree.cElementTree as ET
+PY3 = bytes != str
+
generator_wants_static_library_dependencies_adjusted = False
generator_default_variables = {
@@ -97,6 +99,8 @@ def GetAllIncludeDirectories(target_list, target_dicts,
proc = subprocess.Popen(args=command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = proc.communicate()[1]
+ if PY3:
+ output = output.decode('utf-8')
# Extract the list of include dirs from the output, which has this format:
# ...
# #include "..." search starts here:
@@ -234,6 +238,8 @@ def GetAllDefines(target_list, target_dicts, data, config_name, params,
cpp_proc = subprocess.Popen(args=command, cwd='.',
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
cpp_output = cpp_proc.communicate()[0]
+ if PY3:
+ cpp_output = cpp_output.decode('utf-8')
cpp_lines = cpp_output.split('\n')
for cpp_line in cpp_lines:
if not cpp_line.strip():
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
index bdf713453..196053679 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
@@ -1776,7 +1776,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
# - The multi-output rule will have an do-nothing recipe.
# Hash the target name to avoid generating overlong filenames.
- cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
+ cmddigest = hashlib.sha1((command or self.target).encode('utf-8')).hexdigest()
intermediate = "%s.intermediate" % cmddigest
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
self.WriteLn('\t%s' % '@:')
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py
index b3b4bc105..8dbe0dc05 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py
@@ -12,6 +12,8 @@ import re
import subprocess
import sys
+from collections import OrderedDict
+
import gyp.common
import gyp.easy_xml as easy_xml
import gyp.generator.ninja as ninja_generator
@@ -25,15 +27,7 @@ import gyp.MSVSVersion as MSVSVersion
from gyp.common import GypError
from gyp.common import OrderedSet
-# TODO: Remove once bots are on 2.7, http://crbug.com/241769
-def _import_OrderedDict():
- import collections
- try:
- return collections.OrderedDict
- except AttributeError:
- import gyp.ordered_dict
- return gyp.ordered_dict.OrderedDict
-OrderedDict = _import_OrderedDict()
+PY3 = bytes != str
# Regular expression for validating Visual Studio GUIDs. If the GUID
@@ -124,6 +118,8 @@ def _GetDomainAndUserName():
call = subprocess.Popen(['net', 'config', 'Workstation'],
stdout=subprocess.PIPE)
config = call.communicate()[0]
+ if PY3:
+ config = config.decode('utf-8')
username_re = re.compile(r'^User name\s+(\S+)', re.MULTILINE)
username_match = username_re.search(config)
if username_match:
@@ -175,7 +171,7 @@ def _FixPath(path):
def _IsWindowsAbsPath(path):
- """
+ r"""
On Cygwin systems Python needs a little help determining if a path is an absolute Windows path or not, so that
it does not treat those as relative, which results in bad paths like:
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py
index 1ad68e4fc..5ecfbdf00 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py
@@ -9,7 +9,6 @@
import gyp.generator.ninja as ninja
import unittest
import sys
-import TestCommon
class TestPrefixesAndSuffixes(unittest.TestCase):
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/input.py b/node_modules/node-gyp/gyp/pylib/gyp/input.py
index aba81cf65..2973c078f 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/input.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/input.py
@@ -22,6 +22,7 @@ import traceback
from gyp.common import GypError
from gyp.common import OrderedSet
+PY3 = bytes != str
# A list of types that are treated as linkable.
linkable_types = [
@@ -239,7 +240,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, includes,
if check:
build_file_data = CheckedEval(build_file_contents)
else:
- build_file_data = eval(build_file_contents, {'__builtins__': None},
+ build_file_data = eval(build_file_contents, {'__builtins__': {}},
None)
except SyntaxError as e:
e.filename = build_file_path
@@ -909,6 +910,9 @@ def ExpandVariables(input, phase, variables, build_file):
(e, contents, build_file))
p_stdout, p_stderr = p.communicate('')
+ if PY3:
+ p_stdout = p_stdout.decode('utf-8')
+ p_stderr = p_stderr.decode('utf-8')
if p.wait() != 0 or p_stderr:
sys.stderr.write(p_stderr)
@@ -1090,7 +1094,7 @@ def EvalSingleCondition(
else:
ast_code = compile(cond_expr_expanded, '<string>', 'eval')
cached_conditions_asts[cond_expr_expanded] = ast_code
- if eval(ast_code, {'__builtins__': None}, variables):
+ if eval(ast_code, {'__builtins__': {}}, variables):
return true_dict
return false_dict
except SyntaxError as e:
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py b/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py
index b8b7344ef..222befb98 100755
--- a/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py
@@ -23,6 +23,8 @@ import subprocess
import sys
import tempfile
+PY3 = bytes != str
+
def main(args):
executor = MacTool()
@@ -243,6 +245,8 @@ class MacTool(object):
env['ZERO_AR_DATE'] = '1'
libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env)
_, err = libtoolout.communicate()
+ if PY3:
+ err = err.decode('utf-8')
for line in err.splitlines():
if not libtool_re.match(line) and not libtool_re5.match(line):
print(line, file=sys.stderr)
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py b/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
index 9d50bad1f..9f1f547b9 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
@@ -16,6 +16,7 @@ from gyp.common import OrderedSet
import gyp.MSVSUtil
import gyp.MSVSVersion
+PY3 = bytes != str
windows_quoter_regex = re.compile(r'(\\*)"')
@@ -126,7 +127,10 @@ def _FindDirectXInstallation():
# Setup params to pass to and attempt to launch reg.exe.
cmd = ['reg.exe', 'query', r'HKLM\Software\Microsoft\DirectX', '/s']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- for line in p.communicate()[0].splitlines():
+ stdout = p.communicate()[0]
+ if PY3:
+ stdout = stdout.decode('utf-8')
+ for line in stdout.splitlines():
if 'InstallPath' in line:
dxsdk_dir = line.split(' ')[3] + "\\"
@@ -1038,6 +1042,8 @@ def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags,
popen = subprocess.Popen(
args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
variables, _ = popen.communicate()
+ if PY3:
+ variables = variables.decode('utf-8')
env = _ExtractImportantEnvironment(variables)
# Inject system includes from gyp files into INCLUDE.
@@ -1057,6 +1063,8 @@ def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags,
'for', '%i', 'in', '(cl.exe)', 'do', '@echo', 'LOC:%~$PATH:i'))
popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE)
output, _ = popen.communicate()
+ if PY3:
+ output = output.decode('utf-8')
cl_paths[arch] = _ExtractCLPath(output)
return cl_paths
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py b/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py
deleted file mode 100644
index 6fe9c1f6c..000000000
--- a/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py
+++ /dev/null
@@ -1,289 +0,0 @@
-# Unmodified from http://code.activestate.com/recipes/576693/
-# other than to add MIT license header (as specified on page, but not in code).
-# Linked from Python documentation here:
-# http://docs.python.org/2/library/collections.html#collections.OrderedDict
-#
-# This should be deleted once Py2.7 is available on all bots, see
-# http://crbug.com/241769.
-#
-# Copyright (c) 2009 Raymond Hettinger.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
-# Passes Python2.7's test suite and incorporates all the latest updates.
-
-try:
- from thread import get_ident as _get_ident
-except ImportError:
- from dummy_thread import get_ident as _get_ident
-
-try:
- from _abcoll import KeysView, ValuesView, ItemsView
-except ImportError:
- pass
-
-
-class OrderedDict(dict):
- 'Dictionary that remembers insertion order'
- # An inherited dict maps keys to values.
- # The inherited dict provides __getitem__, __len__, __contains__, and get.
- # The remaining methods are order-aware.
- # Big-O running times for all methods are the same as for regular dictionaries.
-
- # The internal self.__map dictionary maps keys to links in a doubly linked list.
- # The circular doubly linked list starts and ends with a sentinel element.
- # The sentinel element never gets deleted (this simplifies the algorithm).
- # Each link is stored as a list of length three: [PREV, NEXT, KEY].
-
- def __init__(self, *args, **kwds):
- '''Initialize an ordered dictionary. Signature is the same as for
- regular dictionaries, but keyword arguments are not recommended
- because their insertion order is arbitrary.
-
- '''
- if len(args) > 1:
- raise TypeError('expected at most 1 arguments, got %d' % len(args))
- try:
- self.__root
- except AttributeError:
- self.__root = root = [] # sentinel node
- root[:] = [root, root, None]
- self.__map = {}
- self.__update(*args, **kwds)
-
- def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
- 'od.__setitem__(i, y) <==> od[i]=y'
- # Setting a new item creates a new link which goes at the end of the linked
- # list, and the inherited dictionary is updated with the new key/value pair.
- if key not in self:
- root = self.__root
- last = root[0]
- last[1] = root[0] = self.__map[key] = [last, root, key]
- dict_setitem(self, key, value)
-
- def __delitem__(self, key, dict_delitem=dict.__delitem__):
- 'od.__delitem__(y) <==> del od[y]'
- # Deleting an existing item uses self.__map to find the link which is
- # then removed by updating the links in the predecessor and successor nodes.
- dict_delitem(self, key)
- link_prev, link_next, key = self.__map.pop(key)
- link_prev[1] = link_next
- link_next[0] = link_prev
-
- def __iter__(self):
- 'od.__iter__() <==> iter(od)'
- root = self.__root
- curr = root[1]
- while curr is not root:
- yield curr[2]
- curr = curr[1]
-
- def __reversed__(self):
- 'od.__reversed__() <==> reversed(od)'
- root = self.__root
- curr = root[0]
- while curr is not root:
- yield curr[2]
- curr = curr[0]
-
- def clear(self):
- 'od.clear() -> None. Remove all items from od.'
- try:
- for node in self.__map.itervalues():
- del node[:]
- root = self.__root
- root[:] = [root, root, None]
- self.__map.clear()
- except AttributeError:
- pass
- dict.clear(self)
-
- def popitem(self, last=True):
- '''od.popitem() -> (k, v), return and remove a (key, value) pair.
- Pairs are returned in LIFO order if last is true or FIFO order if false.
-
- '''
- if not self:
- raise KeyError('dictionary is empty')
- root = self.__root
- if last:
- link = root[0]
- link_prev = link[0]
- link_prev[1] = root
- root[0] = link_prev
- else:
- link = root[1]
- link_next = link[1]
- root[1] = link_next
- link_next[0] = root
- key = link[2]
- del self.__map[key]
- value = dict.pop(self, key)
- return key, value
-
- # -- the following methods do not depend on the internal structure --
-
- def keys(self):
- 'od.keys() -> list of keys in od'
- return list(self)
-
- def values(self):
- 'od.values() -> list of values in od'
- return [self[key] for key in self]
-
- def items(self):
- 'od.items() -> list of (key, value) pairs in od'
- return [(key, self[key]) for key in self]
-
- def iterkeys(self):
- 'od.iterkeys() -> an iterator over the keys in od'
- return iter(self)
-
- def itervalues(self):
- 'od.itervalues -> an iterator over the values in od'
- for k in self:
- yield self[k]
-
- def items(self):
- 'od.items -> an iterator over the (key, value) items in od'
- for k in self:
- yield (k, self[k])
-
- # Suppress 'OrderedDict.update: Method has no argument':
- # pylint: disable=E0211
- def update(*args, **kwds):
- '''od.update(E, **F) -> None. Update od from dict/iterable E and F.
-
- If E is a dict instance, does: for k in E: od[k] = E[k]
- If E has a .keys() method, does: for k in E.keys(): od[k] = E[k]
- Or if E is an iterable of items, does: for k, v in E: od[k] = v
- In either case, this is followed by: for k, v in F.items(): od[k] = v
-
- '''
- if len(args) > 2:
- raise TypeError('update() takes at most 2 positional '
- 'arguments (%d given)' % (len(args),))
- elif not args:
- raise TypeError('update() takes at least 1 argument (0 given)')
- self = args[0]
- # Make progressively weaker assumptions about "other"
- other = ()
- if len(args) == 2:
- other = args[1]
- if isinstance(other, dict):
- for key in other:
- self[key] = other[key]
- elif hasattr(other, 'keys'):
- for key in other.keys():
- self[key] = other[key]
- else:
- for key, value in other:
- self[key] = value
- for key, value in kwds.items():
- self[key] = value
-
- __update = update # let subclasses override update without breaking __init__
-
- __marker = object()
-
- def pop(self, key, default=__marker):
- '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value.
- If key is not found, d is returned if given, otherwise KeyError is raised.
-
- '''
- if key in self:
- result = self[key]
- del self[key]
- return result
- if default is self.__marker:
- raise KeyError(key)
- return default
-
- def setdefault(self, key, default=None):
- 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
- if key in self:
- return self[key]
- self[key] = default
- return default
-
- def __repr__(self, _repr_running={}):
- 'od.__repr__() <==> repr(od)'
- call_key = id(self), _get_ident()
- if call_key in _repr_running:
- return '...'
- _repr_running[call_key] = 1
- try:
- if not self:
- return '%s()' % (self.__class__.__name__,)
- return '%s(%r)' % (self.__class__.__name__, self.items())
- finally:
- del _repr_running[call_key]
-
- def __reduce__(self):
- 'Return state information for pickling'
- items = [[k, self[k]] for k in self]
- inst_dict = vars(self).copy()
- for k in vars(OrderedDict()):
- inst_dict.pop(k, None)
- if inst_dict:
- return (self.__class__, (items,), inst_dict)
- return self.__class__, (items,)
-
- def copy(self):
- 'od.copy() -> a shallow copy of od'
- return self.__class__(self)
-
- @classmethod
- def fromkeys(cls, iterable, value=None):
- '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S
- and values equal to v (which defaults to None).
-
- '''
- d = cls()
- for key in iterable:
- d[key] = value
- return d
-
- def __eq__(self, other):
- '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
- while comparison to a regular mapping is order-insensitive.
-
- '''
- if isinstance(other, OrderedDict):
- return len(self)==len(other) and self.items() == other.items()
- return dict.__eq__(self, other)
-
- def __ne__(self, other):
- return not self == other
-
- # -- the following methods are only used in Python 2.7 --
-
- def viewkeys(self):
- "od.viewkeys() -> a set-like object providing a view on od's keys"
- return KeysView(self)
-
- def viewvalues(self):
- "od.viewvalues() -> an object providing a view on od's values"
- return ValuesView(self)
-
- def viewitems(self):
- "od.viewitems() -> a set-like object providing a view on od's items"
- return ItemsView(self)
-
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py b/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py
index bca0b9e34..0a6daf203 100755
--- a/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py
@@ -20,6 +20,7 @@ import string
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
+PY3 = bytes != str
# A regex matching an argument corresponding to the output filename passed to
# link.exe.
@@ -124,6 +125,8 @@ class WinTool(object):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
out, _ = link.communicate()
+ if PY3:
+ out = out.decode('utf-8')
for line in out.splitlines():
if (not line.startswith(' Creating library ') and
not line.startswith('Generating code') and
@@ -215,6 +218,8 @@ class WinTool(object):
popen = subprocess.Popen(args, shell=True, env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out, _ = popen.communicate()
+ if PY3:
+ out = out.decode('utf-8')
for line in out.splitlines():
if line and 'manifest authoring warning 81010002' not in line:
print(line)
@@ -247,6 +252,8 @@ class WinTool(object):
popen = subprocess.Popen(args, shell=True, env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out, _ = popen.communicate()
+ if PY3:
+ out = out.decode('utf-8')
# Filter junk out of stdout, and write filtered versions. Output we want
# to filter is pairs of lines that look like this:
# Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl
@@ -266,6 +273,8 @@ class WinTool(object):
popen = subprocess.Popen(args, shell=True, env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out, _ = popen.communicate()
+ if PY3:
+ out = out.decode('utf-8')
for line in out.splitlines():
if (not line.startswith('Copyright (C) Microsoft Corporation') and
not line.startswith('Microsoft (R) Macro Assembler') and
@@ -281,6 +290,8 @@ class WinTool(object):
popen = subprocess.Popen(args, shell=True, env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out, _ = popen.communicate()
+ if PY3:
+ out = out.decode('utf-8')
for line in out.splitlines():
if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and
not line.startswith('Copyright (C) Microsoft Corporation') and
diff --git a/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
index 74735c033..601716499 100644
--- a/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
+++ b/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
@@ -437,7 +437,7 @@ class XcodeSettings(object):
# most sensible route and should still do the right thing.
try:
return GetStdoutQuiet(['xcodebuild', '-version', '-sdk', sdk, infoitem])
- except:
+ except GypError:
pass
def _SdkRoot(self, configname):
@@ -855,7 +855,8 @@ class XcodeSettings(object):
# These flags reflect the compilation options used by xcode to compile
# extensions.
ldflags.append('-lpkstart')
- if XcodeVersion() < '0900':
+ xcode_version, _ = XcodeVersion()
+ if xcode_version < '0900':
ldflags.append(sdk_root +
'/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit')
ldflags.append('-fapplication-extension')
@@ -1088,15 +1089,15 @@ class XcodeSettings(object):
cache = {}
cache['BuildMachineOSBuild'] = self._BuildMachineOSBuild()
- xcode, xcode_build = XcodeVersion()
- cache['DTXcode'] = xcode
+ xcode_version, xcode_build = XcodeVersion()
+ cache['DTXcode'] = xcode_version
cache['DTXcodeBuild'] = xcode_build
sdk_root = self._SdkRoot(configname)
if not sdk_root:
sdk_root = self._DefaultSdkRoot()
cache['DTSDKName'] = sdk_root
- if xcode >= '0430':
+ if xcode_version >= '0430':
cache['DTSDKBuild'] = self._GetSdkVersionInfoItem(
sdk_root, 'ProductBuildVersion')
else:
@@ -1126,7 +1127,7 @@ class XcodeSettings(object):
project, then the environment variable was empty. Starting with this
version, Xcode uses the name of the newest SDK installed.
"""
- xcode_version, xcode_build = XcodeVersion()
+ xcode_version, _ = XcodeVersion()
if xcode_version < '0500':
return ''
default_sdk_path = self._XcodeSdkPath('')
@@ -1135,7 +1136,7 @@ class XcodeSettings(object):
return default_sdk_root
try:
all_sdks = GetStdout(['xcodebuild', '-showsdks'])
- except:
+ except GypError:
# If xcodebuild fails, there will be no valid SDKs
return ''
for line in all_sdks.splitlines():
@@ -1263,10 +1264,12 @@ def XcodeVersion():
# Xcode 3.2.6
# Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
# BuildVersion: 10M2518
- # Convert that to '0463', '4H1503'.
+ # Convert that to ('0463', '4H1503') or ('0326', '10M2518').
global XCODE_VERSION_CACHE
if XCODE_VERSION_CACHE:
return XCODE_VERSION_CACHE
+ version = ""
+ build = ""
try:
version_list = GetStdoutQuiet(['xcodebuild', '-version']).splitlines()
# In some circumstances xcodebuild exits 0 but doesn't return
@@ -1276,21 +1279,16 @@ def XcodeVersion():
# checking that version.
if len(version_list) < 2:
raise GypError("xcodebuild returned unexpected results")
- except:
- version = CLTVersion()
- if version:
- version = ".".join(version.split(".")[:3])
- else:
+ version = version_list[0].split()[-1] # Last word on first line
+ build = version_list[-1].split()[-1] # Last word on last line
+ except GypError: # Xcode not installed so look for XCode Command Line Tools
+ version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322
+ if not version:
raise GypError("No Xcode or CLT version detected!")
- # The CLT has no build information, so we return an empty string.
- version_list = [version, '']
- version = version_list[0]
- build = version_list[-1]
- # Be careful to convert "4.2" to "0420" and "10.0" to "1000":
- version = format(''.join((version.split()[-1].split('.') + ['0', '0'])[:3]),
- '>04s')
- if build:
- build = build.split()[-1]
+ # Be careful to convert "4.2.3" to "0423" and "11.0.0" to "1100":
+ version = version.split(".")[:3] # Just major, minor, micro
+ version[0] = version[0].zfill(2) # Add a leading zero if major is one digit
+ version = ("".join(version) + "00")[:4] # Limit to exactly four characters
XCODE_VERSION_CACHE = (version, build)
return XCODE_VERSION_CACHE
@@ -1314,7 +1312,7 @@ def CLTVersion():
try:
output = GetStdout(['/usr/sbin/pkgutil', '--pkg-info', key])
return re.search(regex, output).groupdict()['version']
- except:
+ except GypError:
continue
@@ -1524,7 +1522,8 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration,
install_name_base = xcode_settings.GetInstallNameBase()
if install_name_base:
env['DYLIB_INSTALL_NAME_BASE'] = install_name_base
- if XcodeVersion() >= '0500' and not env.get('SDKROOT'):
+ xcode_version, _ = XcodeVersion()
+ if xcode_version >= '0500' and not env.get('SDKROOT'):
sdk_root = xcode_settings._SdkRoot(configuration)
if not sdk_root:
sdk_root = xcode_settings._XcodeSdkPath('')