Skip to content

Commit 6b2225c

Browse files
committed
Fix tools/assetlib_release.py
1 parent 436379d commit 6b2225c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tools/assetlib_release.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from urllib.request import urlopen
1212

1313
import argparse
14+
import tarfile
1415
from datetime import datetime
1516
import os
1617
import shutil
@@ -62,20 +63,23 @@ def pipeline_executor(dirs, release_info, platform_name):
6263

6364
if not (dirs["pythonscript"] / platform_name).exists():
6465
print(f"{platform_name} - Extracting release")
65-
shutil.unpack_archive(release_archive.abspath)
6666
if platform_info["name"].endswith(".zip"):
6767
zipobj = ZipFile(release_archive)
6868
# Only extract platform-specific stuff
6969
members = (
70-
x for x in zipobj.namelist() if x.startswith(f"pythonscript/{platform_name}/")
70+
x
71+
for x in zipobj.namelist()
72+
if x.startswith(f"addons/pythonscript/{platform_name}/")
7173
)
72-
zipobj.extractall(path=dirs["pythonscript"].parent, members=members)
74+
zipobj.extractall(path=dirs["dist"], members=members)
7375

74-
if platform_info["name"].endswith(".tar.bz2"):
76+
elif platform_info["name"].endswith(".tar.bz2"):
7577
tarobj = tarfile.open(release_archive)
7678
# Only extract platform-specific stuff
77-
members = (x for x in tarobj if x.name.startswith(f"./pythonscript/{platform_name}/"))
78-
tarobj.extractall(path=dirs["pythonscript"].parent, members=members)
79+
members = (
80+
x for x in tarobj if x.name.startswith(f"./addons/pythonscript/{platform_name}/")
81+
)
82+
tarobj.extractall(path=dirs["dist"], members=members)
7983

8084
else:
8185
raise RuntimeError(f"Unknown archive format for {release_archive}")
@@ -97,7 +101,7 @@ def orchestrator(dirs, release_info):
97101
for entry in ["dist", "pythonscript"]:
98102
(dirs[entry] / "LICENSE.txt").write_text(license_txt)
99103
(dirs["dist"] / "pythonscript.gdnlib").write_text(
100-
(MISC_DIR / "release_pythonscript.gdnlib").read_text().replace("res://", "res://addons/")
104+
(MISC_DIR / "release_pythonscript.gdnlib").read_text()
101105
)
102106
(dirs["dist"] / "README.txt").write_text(
103107
(MISC_DIR / "release_README.txt")
@@ -114,7 +118,7 @@ def main():
114118
release_info = get_release_info(args.version)
115119
print(f"Release version: {release_info['version']}")
116120

117-
build_dir = Path(f"pythonscript-assetlib-release-{release_info['version']}")
121+
build_dir = Path(f"pythonscript-assetlib-release-{release_info['version']}").resolve()
118122
dist_dir = build_dir / f"pythonscript-{release_info['version']}"
119123
addons_dir = dist_dir / "addons"
120124
pythonscript_dir = addons_dir / "pythonscript"

0 commit comments

Comments
 (0)