mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-10 21:55:11 +01:00
Use pathlib instead of os.path
This commit is contained in:
parent
08fbb8d9dc
commit
9968805324
@ -338,6 +338,7 @@ echo "Extract WSA"
|
||||
if [ -f "$WSA_ZIP_PATH" ]; then
|
||||
WSA_WORK_ENV="${WORK_DIR:?}"/ENV
|
||||
if [ -f "$WSA_WORK_ENV" ]; then rm -f "${WSA_WORK_ENV:?}"; fi
|
||||
touch "$WSA_WORK_ENV"
|
||||
export WSA_WORK_ENV
|
||||
if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR"; then
|
||||
echo "Unzip WSA failed, is the download incomplete?"
|
||||
@ -351,8 +352,8 @@ else
|
||||
echo "The WSA zip package does not exist, is the download incomplete?"
|
||||
exit 1
|
||||
fi
|
||||
echo "Extract Magisk"
|
||||
|
||||
echo "Extract Magisk"
|
||||
if [ -f "$MAGISK_PATH" ]; then
|
||||
if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then
|
||||
echo "Unzip Magisk failed, is the download incomplete?"
|
||||
|
@ -21,7 +21,6 @@
|
||||
import sys
|
||||
|
||||
import zipfile
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
|
||||
@ -29,9 +28,9 @@ is_x86_64 = platform.machine() in ("AMD64", "x86_64")
|
||||
host_abi = "x64" if is_x86_64 else "arm64"
|
||||
arch = sys.argv[1]
|
||||
magisk_zip = sys.argv[2]
|
||||
if not os.path.exists(Path.cwd().parent / sys.argv[3] / "magisk"):
|
||||
os.makedirs(Path.cwd().parent / sys.argv[3] / "magisk")
|
||||
workdir = Path.cwd().parent / sys.argv[3] / "magisk"
|
||||
workdir = Path(sys.argv[3]) / "magisk"
|
||||
if not Path(workdir).is_dir():
|
||||
workdir.mkdir()
|
||||
|
||||
abi_map = {"x64": ["x86_64", "x86"], "arm64": ["arm64-v8a", "armeabi-v7a"]}
|
||||
|
||||
|
@ -31,15 +31,15 @@ arch = sys.argv[1]
|
||||
|
||||
zip_name = ""
|
||||
wsa_zip_path= Path(sys.argv[2]).resolve()
|
||||
workdir = Path.cwd().parent / sys.argv[3] / "wsa"
|
||||
if not os.path.exists(workdir):
|
||||
os.makedirs(workdir)
|
||||
workdir = Path(sys.argv[3]) / "wsa"
|
||||
if not Path(workdir).is_dir():
|
||||
workdir.mkdir()
|
||||
with zipfile.ZipFile(wsa_zip_path) as zip:
|
||||
for f in zip.filelist:
|
||||
if arch in f.filename.lower():
|
||||
zip_name = f.filename
|
||||
output_name = zip_name[11:-5]
|
||||
if not os.path.isfile(workdir / zip_name):
|
||||
if not Path(workdir / zip_name).is_file():
|
||||
zip_path = workdir / zip_name
|
||||
print(f"unzipping to {workdir}", flush=True)
|
||||
zip.extract(f, workdir)
|
||||
@ -67,6 +67,6 @@ with zipfile.ZipFile(wsa_zip_path) as zip:
|
||||
g.filename = f'{name}.xml'
|
||||
l.extract(g, workdir / 'xml')
|
||||
with zipfile.ZipFile(zip_path) as zip:
|
||||
if not os.path.isdir(workdir / arch):
|
||||
if not Path(workdir / arch).is_dir():
|
||||
print(f"unzipping from {zip_path}", flush=True)
|
||||
zip.extractall(workdir / arch)
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from io import TextIOWrapper
|
||||
from os import system, path
|
||||
from typing import OrderedDict
|
||||
from pathlib import Path
|
||||
import sys
|
||||
class Prop(OrderedDict):
|
||||
def __init__(self, file: TextIOWrapper) -> None:
|
||||
@ -61,7 +61,7 @@ def fingerprint(sec: str, p: Prop) -> str:
|
||||
|
||||
|
||||
def fix_prop(sec, prop):
|
||||
if not path.exists(prop):
|
||||
if not Path(prop).is_file():
|
||||
return
|
||||
|
||||
print(f"fixing {prop}", flush=True)
|
||||
|
@ -21,7 +21,6 @@
|
||||
import sys
|
||||
|
||||
import requests
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
import sys
|
||||
|
||||
import os
|
||||
import json
|
||||
import requests
|
||||
from pathlib import Path
|
||||
|
@ -25,7 +25,6 @@ from xml.dom import minidom
|
||||
import html
|
||||
import warnings
|
||||
import re
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
@ -81,8 +80,8 @@ for node in doc.getElementsByTagName('SecuredFragment'):
|
||||
with open(Path.cwd().parent / "xml/FE3FileUrl.xml", "r") as f:
|
||||
file_content = f.read()
|
||||
|
||||
if not os.path.exists(download_dir):
|
||||
os.makedirs(download_dir)
|
||||
if not download_dir.is_dir():
|
||||
download_dir.mkdir()
|
||||
tmpdownlist = open(download_dir/tempScript, 'a')
|
||||
for i, v, f in identities:
|
||||
if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", f):
|
||||
|
Loading…
Reference in New Issue
Block a user