|
@@ -49,8 +49,8 @@ ssh.connect(hostname=hostname, port=port, username=username, password=password,a
|
|
|
##############################
|
|
|
##############################
|
|
|
|
|
|
-print("os.getcwd():", os.getcwd())
|
|
|
-local_path = os.getcwd() + "/dist/build" + "/h5.zip"
|
|
|
+print("项目相对本机地址:", os.getcwd())
|
|
|
+local_path = os.getcwd() + "\dist.zip"
|
|
|
|
|
|
target_file_name = sys.argv[2]
|
|
|
|
|
@@ -61,7 +61,7 @@ remote_file_name = remote_path + target_file_name
|
|
|
print("本地文件地址: " + local_path )
|
|
|
print("远程目录地址: " + remote_file_name)
|
|
|
|
|
|
-srmdir_all_folder = os.getcwd() + '/dist/build/h5' # 文件夹路径
|
|
|
+srmdir_all_folder = os.getcwd() + '/dist' # 文件夹路径
|
|
|
|
|
|
zip_file_path = srmdir_all_folder + ".zip" # 压缩文件路径
|
|
|
|
|
@@ -73,7 +73,7 @@ def make_zip(source_dir, output_filename):
|
|
|
for filename in filenames:
|
|
|
pathfile = os.path.join(parent, filename)
|
|
|
arcname = pathfile[pre_len:].strip(os.path.sep) #相对路径
|
|
|
- zipf.write(pathfile, arcname.replace('/h5', ''), zipfile.ZIP_DEFLATED)
|
|
|
+ zipf.write(pathfile, arcname.replace('/dist', ''), zipfile.ZIP_DEFLATED)
|
|
|
zipf.close()
|
|
|
|
|
|
make_zip(srmdir_all_folder, zip_file_path)
|
|
@@ -82,11 +82,11 @@ time.sleep(1)
|
|
|
print("打包完成.....😎")
|
|
|
|
|
|
print("上传中.....💪")
|
|
|
-sftp.put(local_path, remote_file_name + "/h5.zip")
|
|
|
+sftp.put(local_path, remote_file_name + "/dist.zip")
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
-cmd1 = "unzip -o -d " + remote_file_name + " " + remote_file_name + "/h5.zip"
|
|
|
+cmd1 = "unzip -o -d " + remote_file_name + " " + remote_file_name + "/dist.zip"
|
|
|
|
|
|
stdin, stdout, stderr= ssh.exec_command(cmd1)
|
|
|
|