GodotPythonJSONRPC/addons/kiripythonrpcwrapper/PythonBuildExportPlugin.gd

33 lines
1.1 KiB
GDScript3
Raw Normal View History

2024-07-14 08:54:08 -07:00
@tool
extends EditorExportPlugin
class_name KiriPythonBuildExportPlugin
func _export_begin(
features : PackedStringArray, is_debug : bool,
path : String, flags : int):
print("features: ", features)
var build_wrangler : KiriPythonBuildWrangler = KiriPythonBuildWrangler.new()
var platform_list = []
var arch_list = []
if "linux" in features:
#platform_list.append(build_wrangler._get_python_platform("Linux"))
platform_list.append("Linux")
if "windows" in features:
platform_list.append("Windows")
if "x86_64" in features:
arch_list.append("x86_64")
for platform in platform_list:
for arch in arch_list:
var python_arch : String = build_wrangler._get_python_architecture(arch)
var python_platform : String = build_wrangler._get_python_platform(platform, arch)
var archive_to_export = build_wrangler.get_export_python_archive_godot_path(python_platform, python_arch)
#print("EXPORT ME TOO: ", archive_to_export)
var file_contents : PackedByteArray = FileAccess.get_file_as_bytes(archive_to_export)
print("Adding file: ", archive_to_export, " ", len(file_contents))
add_file(archive_to_export, file_contents, false)