summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-05-29 07:51:11 +0200
committerGitHub <noreply@github.com>2018-05-29 07:51:11 +0200
commit5877863b23a4f4510b6f060287c503a4de61f2a2 (patch)
treeba038e109deec0ba45aa0fab8e763d98efa548a4
parent53440ddeec128de3cac7e59853ce0994a8f4214b (diff)
parent27310974e0598e50f87ed51d34a56953e39a8eb6 (diff)
Merge pull request #19227 from ibrahn/fix-py3-build
fixed building using scons with python3.
-rw-r--r--compat.py4
-rw-r--r--methods.py8
2 files changed, 8 insertions, 4 deletions
diff --git a/compat.py b/compat.py
index 32c685f5b8..de99eef9c2 100644
--- a/compat.py
+++ b/compat.py
@@ -16,6 +16,8 @@ if sys.version_info < (3,):
return x
def iteritems(d):
return d.iteritems()
+ def itervalues(d):
+ return d.itervalues()
def escape_string(s):
if isinstance(s, unicode):
s = s.encode('ascii')
@@ -44,6 +46,8 @@ else:
return codecs.utf_8_decode(x)[0]
def iteritems(d):
return iter(d.items())
+ def itervalues(d):
+ return iter(d.values())
def charcode_to_c_escapes(c):
rev_result = []
while c >= 256:
diff --git a/methods.py b/methods.py
index b5aee9c22d..6dca826b2b 100644
--- a/methods.py
+++ b/methods.py
@@ -1,5 +1,5 @@
import os
-from compat import iteritems, open_utf8, escape_string
+from compat import iteritems, itervalues, open_utf8, escape_string
def add_source_files(self, sources, filetype, lib_env=None, shared=False):
@@ -661,7 +661,7 @@ def make_license_header(target, source, env):
reader.next_line()
data_list = []
- for project in projects.itervalues():
+ for project in itervalues(projects):
for part in project:
part["file_index"] = len(data_list)
data_list += part["Files"]
@@ -703,7 +703,7 @@ def make_license_header(target, source, env):
f.write("const ComponentCopyrightPart COPYRIGHT_PROJECT_PARTS[] = {\n")
part_index = 0
part_indexes = {}
- for project_name, project in projects.iteritems():
+ for project_name, project in iteritems(projects):
part_indexes[project_name] = part_index
for part in project:
f.write("\t{ \"" + escape_string(part["License"][0]) + "\", "
@@ -717,7 +717,7 @@ def make_license_header(target, source, env):
f.write("const int COPYRIGHT_INFO_COUNT = " + str(len(projects)) + ";\n")
f.write("const ComponentCopyright COPYRIGHT_INFO[] = {\n")
- for project_name, project in projects.iteritems():
+ for project_name, project in iteritems(projects):
f.write("\t{ \"" + escape_string(project_name) + "\", "
+ "&COPYRIGHT_PROJECT_PARTS[" + str(part_indexes[project_name]) + "], "
+ str(len(project)) + " },\n")