maixtool support windows like path in app.yaml

This commit is contained in:
Neucrack
2025-01-07 15:30:24 +08:00
parent 10b0f2d197
commit 4908c795a5
2 changed files with 12 additions and 3 deletions

View File

@@ -65,6 +65,7 @@ def get_files(project_path, exclude = [], black_list = []):
continue
valid = True
for e in exclude:
e = e.replace("\\", "/")
if e == path or path.startswith(e + "/"):
valid = False
break
@@ -96,6 +97,12 @@ def check_icon_file(files, icon):
if not found:
raise FileNotFoundError("icon file {} not found in files".format(icon))
def check_update_files(files):
final = {}
for k, v in files.items():
final[k.replace("\\", "/")] = v.replace("\\", "/")
return final
def pack(project_path, bin_path="main.py", extra_files = {}):
'''
Find main.py and app.yaml in current directory, pack to dist/app_id_vx.x.x.zip,
@@ -138,11 +145,13 @@ def pack(project_path, bin_path="main.py", extra_files = {}):
bin_name = app_id
app_info["files"][bin_path] = bin_name
app_info["files"][app_yaml] = app_yaml
app_info["files"] = check_update_files(app_info["files"])
extra_files = check_update_files(extra_files)
app_info["files"].update(extra_files)
icon = app_info.get("icon", "")
icon = app_info.get("icon", "").replace("\\", "/")
if icon and icon not in app_info["files"]:
app_info["files"][icon] = icon
check_icon_file(app_info["files"], app_info.get("icon", ""))
check_icon_file(app_info["files"], icon)
copy_files(app_info["files"], project_path, temp_dir)
# zip
version_str = "_v" + app_info["version"]

View File

@@ -1,4 +1,4 @@
__version__ = "1.4.2"
__version__ = "1.4.4"