Copy scene files from content -> engine during release builds. (#70)

This commit is contained in:
Pieter-Jan Briers
2018-05-13 12:34:56 +02:00
committed by GitHub
parent 85b4be3ff4
commit f6b4f23362

View File

@@ -40,6 +40,7 @@ SERVER_IGNORED_RESOURCES = {
GODOT = None
def main():
global GODOT
parser = argparse.ArgumentParser(
@@ -75,6 +76,8 @@ def main():
os.mkdir("release")
copy_godot_scenes()
if "windows" in platforms:
wipe_bin()
if not args.windows_godot_build:
@@ -167,7 +170,6 @@ def build_linux():
server_zip.close()
def build_macos():
print(Fore.GREEN + "Building project for MacOS x64..." + Style.RESET_ALL)
subprocess.run(["msbuild",
@@ -269,5 +271,44 @@ def copy_dir_into_zip(directory, basepath, zipf):
zipf.write(filepath, zippath)
def copy_godot_scenes():
target_dir = p("engine", "SS14.Client.Godot", "Scenes")
from_dir = p("Resources", "Scenes")
for path in os.listdir(from_dir):
if path.startswith("."):
continue
frompath = p(from_dir, path)
targetpath = p(target_dir, path)
if os.path.exists(targetpath):
if os.path.isfile(targetpath):
os.remove(targetpath)
elif os.path.isdir(targetpath):
shutil.rmtree(targetpath)
else:
print("So, what the hell is {} exactly and how did it get there?"
.format(targetpath))
exit(1)
copy_dir_or_file(frompath, targetpath)
def copy_dir_or_file(src, dst):
"""
Just something from src to dst. If src is a dir it gets copied recursively.
"""
if os.path.isfile(src):
shutil.copy2(src, dst)
elif os.path.isdir(src):
shutil.copytree(src, dst)
else:
raise IOError("{} is neither file nor directory. Can't copy.".format(src))
if __name__ == '__main__':
main()