maixtool command support --pkg arg

This commit is contained in:
Neucrack
2024-07-08 18:03:23 +08:00
parent 77b5466e0d
commit 53a81a11ca
3 changed files with 13 additions and 6 deletions

View File

@@ -58,6 +58,7 @@ def serve(pkg_path, port = 8888):
ips.append(ip)
final_ip = None
final_img = None
os.makedirs("dist", exist_ok=True)
for local_ip in ips:
# show qr code
url = "http://{}:{}".format(local_ip, local_port)

View File

@@ -4,20 +4,26 @@ import os
from .app_deploy import serve
from .app_release import pack
def deploy(port):
path = pack(os.getcwd())
print("-- release complete, file:{}".format(path))
serve(path, port)
def deploy(port, pkg_path):
if not pkg_path:
pkg_path = pack(os.getcwd())
print("-- release complete, file:{}".format(pkg_path))
elif not os.path.exists(pkg_path):
raise Exception(f"pakcage path {pkg_path} not exists")
else:
print(f"-- package path: {pkg_path}")
serve(pkg_path, port)
def main():
cmds = ["release", "deploy"]
parser = argparse.ArgumentParser(description='maixtool, tools for maix series development')
parser.add_argument('-v', '--version', action='version', version=__version__)
parser.add_argument('-p', "--port", default=8888, type=int, help="deploy server port")
parser.add_argument("--pkg", default="", type=str, help="app package path")
parser.add_argument("command", help="command to run", choices=cmds)
args = parser.parse_args()
if args.command == "release":
pack(os.getcwd())
elif args.command == "deploy":
deploy(args.port)
deploy(args.port, args.pkg)

View File

@@ -1,4 +1,4 @@
__version__ = "1.2.5"
__version__ = "1.3.2"