diff options
Diffstat (limited to 'platform_methods.py')
-rw-r--r-- | platform_methods.py | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/platform_methods.py b/platform_methods.py index 57b11d1a47..2b157da22b 100644 --- a/platform_methods.py +++ b/platform_methods.py @@ -1,10 +1,7 @@ import os -import sys -import json import platform -import uuid -import functools import subprocess + import methods # NOTE: The multiprocessing module is not compatible with SCons due to conflict on cPickle @@ -43,45 +40,18 @@ def detect_arch(): return "x86_64" -def generate_export_icons(platform_path, platform_name): - """ - Generate headers for logo and run icon for the export plugin. - """ - export_path = platform_path + "/export" - svg_names = [] - if os.path.isfile(export_path + "/logo.svg"): - svg_names.append("logo") - if os.path.isfile(export_path + "/run_icon.svg"): - svg_names.append("run_icon") - - for name in svg_names: - with open(export_path + "/" + name + ".svg", "rb") as svgf: - b = svgf.read(1) - svg_str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n" - svg_str += " static const char *_" + platform_name + "_" + name + '_svg = "' - while len(b) == 1: - svg_str += "\\" + hex(ord(b))[1:] - b = svgf.read(1) - - svg_str += '";\n' - - wf = export_path + "/" + name + "_svg.gen.h" - - methods.write_file_if_needed(wf, svg_str) - - def get_build_version(short): import version name = "custom_build" - if os.getenv("BUILD_NAME") != None: + if os.getenv("BUILD_NAME") is not None: name = os.getenv("BUILD_NAME") v = "%d.%d" % (version.major, version.minor) if version.patch > 0: v += ".%d" % version.patch status = version.status if not short: - if os.getenv("GODOT_VERSION_STATUS") != None: + if os.getenv("GODOT_VERSION_STATUS") is not None: status = str(os.getenv("GODOT_VERSION_STATUS")) v += ".%s.%s" % (status, name) return v @@ -113,7 +83,7 @@ def get_mvk_sdk_path(osname): def int_or_zero(i): try: return int(i) - except: + except (TypeError, ValueError): return 0 def ver_parse(a): @@ -167,9 +137,8 @@ def detect_mvk(env, osname): ) for mvk_path in mvk_list: - if mvk_path and os.path.isfile(os.path.join(mvk_path, osname + "/libMoltenVK.a")): - mvk_found = True - print("MoltenVK found at: " + mvk_path) + if mvk_path and os.path.isfile(os.path.join(mvk_path, f"{osname}/libMoltenVK.a")): + print(f"MoltenVK found at: {mvk_path}") return mvk_path return "" |