5
5
import sys
6
6
import platform
7
7
import importlib .util
8
- from typing import List , Sequence
8
+ from typing import List , Sequence , Optional
9
9
from contextlib import contextmanager
10
10
import argparse
11
11
from pathlib import Path
@@ -114,7 +114,12 @@ def symlink(src: Path, dst: Path) -> None:
114
114
os .symlink (str (src .resolve ()), str (dst .resolve ()))
115
115
116
116
117
- def create_test_workdir (test_dir : Path , distrib_workdir : Path , test_workdir : Path ) -> None :
117
+ def create_test_workdir (
118
+ test_dir : Path ,
119
+ distrib_workdir : Path ,
120
+ test_workdir : Path ,
121
+ custom_gdextension_api : Optional [Path ],
122
+ ) -> None :
118
123
print (
119
124
f"{ YELLOW } { test_dir .name } : Create&populate test workdir in { test_workdir } { NO_COLOR } " ,
120
125
flush = True ,
@@ -123,7 +128,10 @@ def create_test_workdir(test_dir: Path, distrib_workdir: Path, test_workdir: Pat
123
128
symlink (distrib_workdir / "addons" , test_workdir / "addons" )
124
129
shutil .copy (distrib_workdir / "pythonscript.gdextension" , test_workdir )
125
130
# GDExtension headers are needed to compile Cython modules
126
- symlink (build_dir / "gdextension_api" , test_workdir / "gdextension_api" )
131
+ if custom_gdextension_api :
132
+ shutil .copytree (custom_gdextension_api , test_workdir / "gdextension_api" )
133
+ else :
134
+ symlink (build_dir / "gdextension_api" , test_workdir / "gdextension_api" )
127
135
128
136
build_script = test_workdir / "build.py"
129
137
if build_script .exists ():
@@ -262,6 +270,11 @@ def run_test(
262
270
action = "store_true" ,
263
271
help = "Only update the addons build symlinked into all test projects" ,
264
272
)
273
+ parser .add_argument (
274
+ "--custom-gdextension-api" ,
275
+ type = Path ,
276
+ help = "Copy GDExtension API folder from there instead of symlink the build one (useful if you have issues on Windows)" ,
277
+ )
265
278
266
279
try :
267
280
options_separator = sys .argv .index ("--" )
@@ -312,5 +325,6 @@ def test_workdir_factory():
312
325
test_dir = test_dir ,
313
326
distrib_workdir = distrib_workdir ,
314
327
test_workdir = test_workdir ,
328
+ custom_gdextension_api = args .custom_gdextension_api ,
315
329
)
316
330
run_test (test_dir .name , test_workdir , godot_binary_path , godot_extra_args )
0 commit comments