Skip to content

Commit

Permalink
Support python3 in SCons
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelKatz authored and bachase committed Nov 29, 2017
1 parent a4a43a4 commit 5a9c3c7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Builds/Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ def powerset(iterable):

if IS_WINDOWS:
CMAKE_DIR_TARGETS = { ('msvc' + unity,) : targets for unity, targets in
CMAKE_UNITY_COMBOS.iteritems() }
CMAKE_UNITY_COMBOS.items() }
elif IS_OS_X:
CMAKE_DIR_TARGETS = { (build + unity,) : targets
for build in ['debug', 'release']
for unity, targets in CMAKE_UNITY_COMBOS.iteritems() }
for unity, targets in CMAKE_UNITY_COMBOS.items() }
else:
CMAKE_DIR_TARGETS = { (cc + "." + build + unity,) : targets
for cc in ['gcc', 'clang']
for build in ['debug', 'release', 'coverage', 'profile']
for unity, targets in CMAKE_UNITY_COMBOS.iteritems() }
for unity, targets in CMAKE_UNITY_COMBOS.items() }

# list of tuples of all possible options
if IS_WINDOWS or IS_OS_X:
Expand Down Expand Up @@ -450,7 +450,7 @@ def main():
ARGS.build_option = list(ARGS.extra_args)

for args in generator_options:
for build_dirs, (build_targets, build_configs) in build_dir_targets.iteritems():
for build_dirs, (build_targets, build_configs) in build_dir_targets.items():
if not build_dirs:
build_dirs = ('default',)
if not build_targets:
Expand Down
8 changes: 4 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def get_libs(lib, static):
try:
cmd = ['pkg-config', '--static', '--libs', lib]
libs = subprocess.check_output(cmd,
stderr=subprocess.STDOUT).strip()
stderr=subprocess.STDOUT).strip().decode("utf-8")
all_libs = [l[2:] for l in libs.split() if l.startswith('-l')]
if not static:
return ([], all_libs)
Expand Down Expand Up @@ -1162,7 +1162,7 @@ for tu_style in ['classic', 'unity']:
os.path.join(variant_dir, 'proto') :
os.path.join (build_dir, 'proto'),
}
for dest, source in variant_dirs.iteritems():
for dest, source in variant_dirs.items():
env.VariantDir(dest, source, duplicate=0)

object_builder = ObjectBuilder(env, variant_dirs)
Expand Down Expand Up @@ -1265,7 +1265,7 @@ for tu_style in ['classic', 'unity']:
[object_builder.env] + object_builder.child_envs + [base],
dest_file='build.ninja')

for key, value in aliases.iteritems():
for key, value in aliases.items():
env.Alias(key, value)

vcxproj = base.VSProject(
Expand Down Expand Up @@ -1306,6 +1306,6 @@ def do_count(target, source, env):
lines = 0
for f in testfiles:
lines = lines + sum(1 for line in open(f))
print "Total unit test lines: %d" % lines
print ("Total unit test lines: %d" % lines)

PhonyTargets(env, count = do_count)
2 changes: 1 addition & 1 deletion src/ripple/beast/site_scons/Beast.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def doPrint(tgt, level, found):
def variantFile(path, variant_dirs):
'''Returns the path to the corresponding dict entry in variant_dirs'''
path = str(path)
for dest, source in variant_dirs.iteritems():
for dest, source in variant_dirs.items():
common = os.path.commonprefix([path, source])
if common == source:
return os.path.join(dest, path[len(common)+1:])
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/beast/site_scons/site_tools/VSProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,12 @@ def getGroup(abspath):
def build(self):
try:
self.project_file = open(str(self.project_node), 'wb')
except IOError, detail:
except (IOError, detail):
raise SCons.Errors.InternalError('Unable to open "' +
str(self.project_node) + '" for writing:' + str(detail))
try:
self.filters_file = open(str(self.filters_node), 'wb')
except IOError, detail:
except (IOError, detail):
raise SCons.Errors.InternalError('Unable to open "' +
str(self.filters_node) + '" for writing:' + str(detail))
self.writeProject()
Expand Down

0 comments on commit 5a9c3c7

Please sign in to comment.