diff options
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/methods.py b/methods.py index 56c495468d..dc82c97361 100644 --- a/methods.py +++ b/methods.py @@ -2,12 +2,11 @@ import os import re import glob import subprocess -from compat import iteritems, isbasestring, decode_utf8 def add_source_files(self, sources, files, warn_duplicates=True): # Convert string to list of absolute paths (including expanding wildcard) - if isbasestring(files): + if isinstance(files, (str, bytes)): # Keep SCons project-absolute path as they are (no wildcard support) if files.startswith('#'): if '*' in files: @@ -62,6 +61,9 @@ def update_version(module_version_string=""): # NOTE: It is safe to generate this file here, since this is still executed serially f = open("core/version_generated.gen.h", "w") + f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + f.write("#ifndef VERSION_GENERATED_GEN_H\n") + f.write("#define VERSION_GENERATED_GEN_H\n") f.write("#define VERSION_SHORT_NAME \"" + str(version.short_name) + "\"\n") f.write("#define VERSION_NAME \"" + str(version.name) + "\"\n") f.write("#define VERSION_MAJOR " + str(version.major) + "\n") @@ -72,10 +74,14 @@ def update_version(module_version_string=""): f.write("#define VERSION_MODULE_CONFIG \"" + str(version.module_config) + module_version_string + "\"\n") f.write("#define VERSION_YEAR " + str(version.year) + "\n") f.write("#define VERSION_WEBSITE \"" + str(version.website) + "\"\n") + f.write("#endif // VERSION_GENERATED_GEN_H\n") f.close() # NOTE: It is safe to generate this file here, since this is still executed serially fhash = open("core/version_hash.gen.h", "w") + fhash.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + fhash.write("#ifndef VERSION_HASH_GEN_H\n") + fhash.write("#define VERSION_HASH_GEN_H\n") githash = "" gitfolder = ".git" @@ -93,7 +99,8 @@ def update_version(module_version_string=""): else: githash = head - fhash.write("#define VERSION_HASH \"" + githash + "\"") + fhash.write("#define VERSION_HASH \"" + githash + "\"\n") + fhash.write("#endif // VERSION_HASH_GEN_H\n") fhash.close() @@ -232,7 +239,7 @@ def use_windows_spawn_fix(self, platform=None): cmdline = cmd + " " + newargs rv = 0 - env = {str(key): str(value) for key, value in iteritems(env)} + env = {str(key): str(value) for key, value in iter(env.items())} if len(cmdline) > 32000 and cmd.endswith("ar"): cmdline = cmd + " " + args[1] + " " + args[2] + " " for i in range(3, len(args)): @@ -522,7 +529,7 @@ def detect_darwin_sdk_path(platform, env): if not env[var_name]: try: - sdk_path = decode_utf8(subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip()) + sdk_path = subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip().decode("utf-8") if sdk_path: env[var_name] = sdk_path except (subprocess.CalledProcessError, OSError): @@ -532,7 +539,7 @@ def detect_darwin_sdk_path(platform, env): def is_vanilla_clang(env): if not using_clang(env): return False - version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip()) + version = subprocess.check_output([env['CXX'], '--version']).strip().decode("utf-8") return not version.startswith("Apple") @@ -545,7 +552,7 @@ def get_compiler_version(env): # Not using -dumpversion as some GCC distros only return major, and # Clang used to return hardcoded 4.2.1: # https://reviews.llvm.org/D56803 try: - version = decode_utf8(subprocess.check_output([env.subst(env['CXX']), '--version']).strip()) + version = subprocess.check_output([env.subst(env['CXX']), '--version']).strip().decode("utf-8") except (subprocess.CalledProcessError, OSError): print("Couldn't parse CXX environment variable to infer compiler version.") return None |