-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gyp: cherrypick more Python3 changes from node-gyp #28563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
# toplevel Makefile. It may make sense to generate some .mk files on | ||
# the side to keep the files readable. | ||
|
||
from __future__ import print_function | ||
|
||
import os | ||
import re | ||
import sys | ||
|
@@ -650,7 +652,7 @@ def _ValidateSourcesForOSX(spec, all_sources): | |
basenames.setdefault(basename, []).append(source) | ||
|
||
error = '' | ||
for basename, files in basenames.iteritems(): | ||
for basename, files in basenames.items(): | ||
if len(files) > 1: | ||
error += ' %s: %s\n' % (basename, ' '.join(files)) | ||
|
||
|
@@ -1202,16 +1204,16 @@ def WriteSources(self, configs, deps, sources, | |
cflags_c = config.get('cflags_c') | ||
cflags_cc = config.get('cflags_cc') | ||
|
||
self.WriteLn("# Flags passed to all source files."); | ||
self.WriteLn("# Flags passed to all source files.") | ||
self.WriteList(cflags, 'CFLAGS_%s' % configname) | ||
self.WriteLn("# Flags passed to only C files."); | ||
self.WriteLn("# Flags passed to only C files.") | ||
self.WriteList(cflags_c, 'CFLAGS_C_%s' % configname) | ||
self.WriteLn("# Flags passed to only C++ files."); | ||
self.WriteLn("# Flags passed to only C++ files.") | ||
self.WriteList(cflags_cc, 'CFLAGS_CC_%s' % configname) | ||
if self.flavor == 'mac': | ||
self.WriteLn("# Flags passed to only ObjC files."); | ||
self.WriteLn("# Flags passed to only ObjC files.") | ||
self.WriteList(cflags_objc, 'CFLAGS_OBJC_%s' % configname) | ||
self.WriteLn("# Flags passed to only ObjC++ files."); | ||
self.WriteLn("# Flags passed to only ObjC++ files.") | ||
self.WriteList(cflags_objcc, 'CFLAGS_OBJCC_%s' % configname) | ||
includes = config.get('include_dirs') | ||
if includes: | ||
|
@@ -1359,8 +1361,8 @@ def ComputeOutputBasename(self, spec): | |
elif self.type == 'none': | ||
target = '%s.stamp' % target | ||
elif self.type != 'executable': | ||
print ("ERROR: What output file should be generated?", | ||
"type", self.type, "target", target) | ||
print("ERROR: What output file should be generated?", | ||
"type", self.type, "target", target) | ||
|
||
target_prefix = spec.get('product_prefix', target_prefix) | ||
target = spec.get('product_name', target) | ||
|
@@ -1524,7 +1526,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps, | |
# Postbuilds expect to be run in the gyp file's directory, so insert an | ||
# implicit postbuild to cd to there. | ||
postbuilds.insert(0, gyp.common.EncodePOSIXShellList(['cd', self.path])) | ||
for i in xrange(len(postbuilds)): | ||
for i in range(len(postbuilds)): | ||
if not postbuilds[i].startswith('$'): | ||
postbuilds[i] = EscapeShellArgument(postbuilds[i]) | ||
self.WriteLn('%s: builddir := $(abs_builddir)' % QuoteSpaces(self.output)) | ||
|
@@ -1616,7 +1618,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps, | |
self.WriteDoCmd([self.output_binary], deps, 'touch', part_of_all, | ||
postbuilds=postbuilds) | ||
else: | ||
print "WARNING: no output for", self.type, target | ||
print("WARNING: no output for", self.type, self.target) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why has target become self.target here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From upstream nodejs/node-gyp#1334 (comment) last year. target was an undefined name in this context because it was neither defined nor imported. However, self.target is used above and a few lines below. These don't forget self issues are fairly common. In a compiled language this would be easily caught as compile-time error. However in a dynamic language like Python, we either find them with a linter or they when they halt our scripts at runtime. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assumed as much but wanted to confirm it was intentional :) |
||
|
||
# Add an alias for each target (if there are any outputs). | ||
# Installable target aliases are created below. | ||
|
@@ -1968,7 +1970,7 @@ def PerformBuild(data, configurations, params): | |
if options.toplevel_dir and options.toplevel_dir != '.': | ||
arguments += '-C', options.toplevel_dir | ||
arguments.append('BUILDTYPE=' + config) | ||
print 'Building [%s]: %s' % (config, arguments) | ||
print('Building [%s]: %s' % (config, arguments)) | ||
subprocess.check_call(arguments) | ||
|
||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.