Skip to content

Instantly share code, notes, and snippets.

@Aikhjarto
Created May 16, 2020 16:38
Show Gist options
  • Save Aikhjarto/67eb9d054dcd91b2e6c0ea32c86c64a6 to your computer and use it in GitHub Desktop.
Save Aikhjarto/67eb9d054dcd91b2e6c0ea32c86c64a6 to your computer and use it in GitHub Desktop.
webrtc build with python 3.7 patch
diff --git a/android/gyp/create_apk_operations_script.py b/android/gyp/create_apk_operations_script.py
index a39752bcf..c5306dc55 100755
--- a/android/gyp/create_apk_operations_script.py
+++ b/android/gyp/create_apk_operations_script.py
@@ -87,7 +87,7 @@ def main(args):
'TARGET_CPU': repr(args.target_cpu),
}
script.write(SCRIPT_TEMPLATE.substitute(script_dict))
- os.chmod(args.script_output_path, 0750)
+ os.chmod(args.script_output_path, 0o750)
return 0
diff --git a/android/gyp/util/build_utils.py b/android/gyp/util/build_utils.py
index bc15fbb61..6bb18644a 100644
--- a/android/gyp/util/build_utils.py
+++ b/android/gyp/util/build_utils.py
@@ -256,9 +256,9 @@ def CheckOutput(args, cwd=None, env=None,
raise CalledProcessError(cwd, args, stdout + stderr)
if print_stdout:
- sys.stdout.write(stdout)
+ sys.stdout.write(stdout.decode('utf-8'))
if print_stderr:
- sys.stderr.write(stderr)
+ sys.stderr.write(stderr.decode('utf-8'))
return stdout
@@ -550,9 +550,19 @@ def ComputePythonDependencies():
_ForceLazyModulesToLoad()
module_paths = (m.__file__ for m in sys.modules.values()
if m is not None and hasattr(m, '__file__'))
- abs_module_paths = map(os.path.abspath, module_paths)
+ #abs_module_paths = map(os.path.abspath, module_paths)
+ def abspath_35(m):
+ # mimik os.abspath behaviour of python <=3.5)
+ # https://bugs.python.org/issue22587
+ if m is None:
+ return os.getcwd()
+ else:
+ return os.path.abspath(m)
+
+ abs_module_paths = [abspath_35(m) for m in module_paths]
abs_dir_source_root = os.path.abspath(DIR_SOURCE_ROOT)
+ print('Debug:', abs_module_paths, abs_dir_source_root)
non_system_module_paths = [
p for p in abs_module_paths if p.startswith(abs_dir_source_root)
]
diff --git a/android/gyp/util/md5_check.py b/android/gyp/util/md5_check.py
index a8a815e7e..28c9aa1da 100644
--- a/android/gyp/util/md5_check.py
+++ b/android/gyp/util/md5_check.py
@@ -443,7 +443,7 @@ def _ComputeInlineMd5(iterable):
"""Computes the md5 of the concatenated parameters."""
md5 = hashlib.md5()
for item in iterable:
- md5.update(str(item))
+ md5.update(str(item).encode('utf-8'))
return md5.hexdigest()
diff --git a/android/gyp/write_build_config.py b/android/gyp/write_build_config.py
index 02b02fcd5..4645f3b19 100755
--- a/android/gyp/write_build_config.py
+++ b/android/gyp/write_build_config.py
@@ -755,7 +755,7 @@ def _MergeAssets(all_assets):
locale_paks.add(dest)
def create_list(asset_map):
- ret = ['%s:%s' % (src, dest) for dest, src in asset_map.iteritems()]
+ ret = ['%s:%s' % (src, dest) for dest, src in asset_map.items()]
# Sort to ensure deterministic ordering.
ret.sort()
return ret
@@ -1555,7 +1555,7 @@ def main(argv):
configs_by_classpath_entry = collections.defaultdict(list)
static_lib_jar_paths = {}
for config_path, dep_config in (sorted(
- static_library_dependent_configs_by_path.iteritems())):
+ static_library_dependent_configs_by_path.items())):
# For bundles, only the jar path and jni sources of the base module
# are relevant for proguard. Should be updated when bundle feature
# modules support JNI.
@@ -1584,7 +1584,7 @@ def main(argv):
for cp_entry in java_full_classpath:
configs_by_classpath_entry[cp_entry].append(options.build_config)
- for cp_entry, candidate_configs in configs_by_classpath_entry.iteritems():
+ for cp_entry, candidate_configs in configs_by_classpath_entry.items():
config_path = (candidate_configs[0]
if len(candidate_configs) == 1 else options.build_config)
classpath_entries_by_owning_config[config_path].append(cp_entry)
@@ -1594,11 +1594,11 @@ def main(argv):
deps_info['static_library_proguard_mapping_output_paths'] = sorted([
d['proguard_mapping_path']
- for d in static_library_dependent_configs_by_path.itervalues()
+ for d in static_library_dependent_configs_by_path.values()
])
deps_info['static_library_dependent_classpath_configs'] = {
path: sorted(set(classpath))
- for path, classpath in classpath_entries_by_owning_config.iteritems()
+ for path, classpath in classpath_entries_by_owning_config.items()
}
deps_info['extra_main_r_text_files'] = sorted(extra_main_r_text_files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment