windows fixes

This commit is contained in:
Joey Eamigh
2023-06-21 20:34:44 -04:00
parent be1db9d555
commit 7682582364
3 changed files with 65 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import os, sys, argparse, tempfile, subprocess, shutil, requests
import os, sys, argparse, tempfile, subprocess, shutil, requests, zipfile
from git.repo import Repo
from termcolor import cprint
@@ -8,6 +8,7 @@ parser = argparse.ArgumentParser(description="a helper script for liightninggod
parser.add_argument("--export", "-e", help="export modpack zip", action="store_true")
parser.add_argument("--release", "-r", help="release modpack version", action="store_true")
parser.add_argument("--client", "-c", help="export modpack client as a zip file", action="store_true")
parser.add_argument("--setup", "-s", help="setup project and install dependencies", action="store_true")
parser.add_argument("--force", "-f", help="forces things when needed, like redoing setup", action="store_true")
parser.add_argument("--build-pax", help="builds pax from source, even if on a supported platform", action="store_true")
@@ -39,12 +40,27 @@ def __main__():
elif args.release:
release()
return
elif args.client:
print("exporting modpack client")
export_client()
return
print(
"no command provided. pass the -h flag to see commands for tooling, or run ./pax to interact with the modpack's files"
)
# client
def export_client():
z = zipfile.ZipFile(".out/FishPogPixelmonClient.zip", "w", zipfile.ZIP_DEFLATED)
z.write("client/README.md", "README.md")
z.write("client/client.ps1", "client.ps1")
z.write("client/client.sh", "client.sh")
z.write("client/requirements.txt", "requirements.txt")
z.write("client/client.py", "client.py")
z.close()
# setup
def setup_pack():
pax()
@@ -108,7 +124,7 @@ def pax():
os.chmod("pax", 0o755)
return
if OS == "windows":
if OS == "win32":
print("downloading and extracting pax for windows...")
r = requests.get(PAX_WINDOWS, allow_redirects=True)
open("pax-windows.zip", "wb").write(r.content)
@@ -118,7 +134,7 @@ def pax():
def pax_from_source():
if OS == "windows":
if OS == "win32":
cprint("building from source not supported on windows yet", "red")
exit(1)