|
11 | 11 | from pathlib import Path
|
12 | 12 |
|
13 | 13 | GODOT_REPOSITORY_URL = "https://github.com/godotengine/godot"
|
| 14 | +BRANCH = "3.2" |
14 | 15 | GODOT_REPOSITORY_PATH = "godot"
|
15 | 16 | CLASSES_PATH = "doc/classes"
|
16 |
| -GODOT_CLASSES_FILE = "../godot_classes" |
| 17 | +GODOT_CLASSES_FILE = "godot_classes" + "-" + BRANCH + ".txt" |
17 | 18 |
|
18 | 19 | script_path = Path(__file__).absolute().parent
|
19 | 20 | os.chdir(script_path)
|
20 | 21 |
|
21 | 22 | # clone if not already done
|
22 | 23 | if not Path(GODOT_REPOSITORY_PATH).exists():
|
23 |
| - subprocess.call(["git", "clone", "--no-checkout", "--branch", "3.2", |
| 24 | + subprocess.call(["git", "clone", "--no-checkout", "--branch", BRANCH, |
24 | 25 | "--single-branch", "--depth", "1", GODOT_REPOSITORY_URL, GODOT_REPOSITORY_PATH])
|
25 | 26 |
|
26 | 27 | # sparse checkout
|
|
29 | 30 | subprocess.call(["git", "sparse-checkout", "set", CLASSES_PATH])
|
30 | 31 |
|
31 | 32 | # get those files
|
32 |
| -file_names = "[\n" |
| 33 | +file_content = "// This file was automatically generated from the file names at " + \ |
| 34 | + GODOT_REPOSITORY_URL + "/tree/" + BRANCH + "/doc/classes\n" |
| 35 | +file_content += "[\n" |
33 | 36 | for file in Path(CLASSES_PATH).glob("*"):
|
34 | 37 | file_name = file.name
|
35 | 38 | if (not file_name.startswith("@")) and file_name.endswith(".xml"):
|
36 |
| - file_names += " \"" |
| 39 | + file_content += " \"" |
37 | 40 | file_name = file_name[:-4]
|
38 |
| - file_names += file_name |
39 |
| - file_names += "\",\n" |
40 |
| -file_names += "]" |
41 |
| -Path("../" + GODOT_CLASSES_FILE).write_text(file_names) |
| 41 | + file_content += file_name |
| 42 | + file_content += "\",\n" |
| 43 | +file_content += "]" |
| 44 | +Path("../" + GODOT_CLASSES_FILE).write_text(file_content) |
0 commit comments