mirror of
https://github.com/sipeed/MaixCDK.git
synced 2026-09-11 06:09:42 -05:00
maixtool command support --pkg arg
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
__version__ = "1.2.5"
|
||||
__version__ = "1.3.2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user