summaryrefslogtreecommitdiffstats
path: root/platform_methods.py
diff options
context:
space:
mode:
Diffstat (limited to 'platform_methods.py')
-rw-r--r--platform_methods.py46
1 files changed, 7 insertions, 39 deletions
diff --git a/platform_methods.py b/platform_methods.py
index 56115db4a4..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
@@ -39,50 +36,22 @@ def detect_arch():
# Catches x86, i386, i486, i586, i686, etc.
return "x86_32"
else:
- print("Unsupported CPU architecture: " + host_machine)
- print("Falling back to x86_64.")
+ methods.print_warning(f'Unsupported CPU architecture: "{host_machine}". Falling back to x86_64.')
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
@@ -114,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):
@@ -168,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 ""