修改项目结构

This commit is contained in:
2026-04-13 06:27:15 +08:00
parent 9e7ca9a580
commit c0740883a0
16 changed files with 10 additions and 260 deletions

6
build.py Normal file
View File

@@ -0,0 +1,6 @@
# 构建文件
# 确定系统和架构
import platform
os_name = platform.system()
print(" 系统名称:", os_name)

View File

@@ -1,63 +0,0 @@
#打包脚本
import subprocess, os, sys
# 建立venv虚拟环境
print("建立venv虚拟环境")
subprocess.run("python3 -m venv venv", shell=True)
# 安装requirements.txt中的库
print("安装requirements.txt中的库")
subprocess.run("venv/bin/pip3 install -r ../requirements.txt", shell=True)
# 列出pip安装的库
print("列出pip安装的库")
subprocess.run("venv/bin/pip3 list", shell=True)
# pyinstaller打包程序
print("pyinstaller打包中")
print("打包main.py")
subprocess.run("venv/bin/pyinstaller --onefile command/main.py", shell=True)
print("打包help.py")
subprocess.run("venv/bin/pyinstaller --onefile command/help.py", shell=True)
print("打包Download.py")
subprocess.run("venv/bin/pyinstaller --onefile command/Download.py", shell=True)
print("打包version.py")
subprocess.run("venv/bin/pyinstaller --onefile command/version.py", shell=True)
# 清理build和*.spec文件
print("清理build和*.spec文件")
subprocess.run("rm -rf build/", shell=True)
print("正在清理*.spec文件")
subprocess.run("rm -rf main.spec version.spec Download.spec help.spec", shell=True)
# 重命名dist为jm_
print("重命名dist为jm_")
dir_path = os.path.dirname(os.path.abspath(__file__))
print("当前路径: " , f"{dir_path}")
pass
os.rename(f"{dir_path}/dist", "jm_")
# 测试程序
print("测试程序")
print("建立测试脚本test.sh")
subprocess.run("""
cat <<EOF>> test.sh
#!/bin/sh
cd ./jm_/
./main
./main help
./main version
EOF
""", shell=True)
print("赋予test.sh可执行权限")
subprocess.run("chmod +x test.sh", shell=True)
print("运行test.sh测试脚本")
subprocess.run("/bin/sh test.sh", shell=True)
# 测试完毕删除test.sh脚本
print("测试完毕删除test.sh脚本")
subprocess.run("rm -rf test.sh", shell=True)
print("大功告成~感谢您的使用")

View File

@@ -1,8 +0,0 @@
import jmcomic as jm
import os, sys
print(f'请输入 jmcomic 车号')
car_id = input()
jm.download_album(car_id)

View File

@@ -1,2 +0,0 @@
print("jm", "{:12}选择你需要下载的漫画".format(" "))
print("version", "{:7}查看当前版本".format(" "))

View File

@@ -1,18 +0,0 @@
import sys, subprocess
# 设定
if len(sys.argv) == 1:
# 如果什么都没输入就输出
subprocess.run("./help", check=True)
if len(sys.argv) > 1:
command = sys.argv[1]
if command == "help":
subprocess.run("./help", check=True)
elif command == "jm":
subprocess.run("./Download", check=True)
elif command == "version":
subprocess.run("./version", check=True)
else:
print(f"未知的命令: {command}")

View File

@@ -1,2 +0,0 @@
print("jm_download_python")
print("2026-02-04", "(v0.02)")

View File

@@ -1,63 +0,0 @@
#打包脚本
import subprocess, os, sys
# 建立venv虚拟环境
print("建立venv虚拟环境")
subprocess.run("python3 -m venv venv", shell=True)
# 安装requirements.txt中的库
print("安装requirements.txt中的库")
subprocess.run("venv/bin/pip3 install -r ../requirements.txt", shell=True)
# 列出pip安装的库
print("列出pip安装的库")
subprocess.run("venv/bin/pip3 list", shell=True)
# pyinstaller打包程序
print("pyinstaller打包中")
print("打包main.py")
subprocess.run("venv/bin/pyinstaller --onefile command/main.py", shell=True)
print("打包help.py")
subprocess.run("venv/bin/pyinstaller --onefile command/help.py", shell=True)
print("打包Download.py")
subprocess.run("venv/bin/pyinstaller --onefile command/Download.py", shell=True)
print("打包version.py")
subprocess.run("venv/bin/pyinstaller --onefile command/version.py", shell=True)
# 清理build和*.spec文件
print("清理build和*.spec文件")
subprocess.run("rm -rf build/", shell=True)
print("正在清理*.spec文件")
subprocess.run("rm -rf main.spec version.spec Download.spec help.spec", shell=True)
# 重命名dist为jm_
print("重命名dist为jm_")
dir_path = os.path.dirname(os.path.abspath(__file__))
print("当前路径: " , f"{dir_path}")
pass
os.rename(f"{dir_path}/dist", "jm_")
# 测试程序
print("测试程序")
print("建立测试脚本test.sh")
subprocess.run("""
cat <<EOF>> test.sh
#!/bin/sh
cd ./jm_/
./main
./main help
./main version
EOF
""", shell=True)
print("赋予test.sh可执行权限")
subprocess.run("chmod +x test.sh", shell=True)
print("运行test.sh测试脚本")
subprocess.run("/bin/sh test.sh", shell=True)
# 测试完毕删除test.sh脚本
print("测试完毕删除test.sh脚本")
subprocess.run("rm -rf test.sh", shell=True)
print("大功告成~感谢您的使用")

View File

@@ -1,2 +0,0 @@
print("jm", "{:12}选择你需要下载的漫画".format(" "))
print("version", "{:7}查看当前版本".format(" "))

View File

@@ -1,18 +0,0 @@
import sys, subprocess
# 设定
if len(sys.argv) == 1:
# 如果什么都没输入就输出
subprocess.run("./help", check=True)
if len(sys.argv) > 1:
command = sys.argv[1]
if command == "help":
subprocess.run("./help", check=True)
elif command == "jm":
subprocess.run("./Download", check=True)
elif command == "version":
subprocess.run("./version", check=True)
else:
print(f"未知的命令: {command}")

View File

@@ -1,2 +0,0 @@
print("jm_download_python")
print("2026-02-04", "(v0.02)")

View File

@@ -1,8 +1,11 @@
# 主函数
# 引入 jmcomic
import jmcomic as jm
import os, sys
# 下载功能
print(f'请输入 jmcomic 车号')
car_id = input()
jm.download_album(car_id)

View File

@@ -1,51 +0,0 @@
#打包脚本
import subprocess, os, sys
# 建立venv虚拟环境
print("建立venv虚拟环境")
subprocess.run("python -m venv venv", shell=True)
# 安装requirements.txt中的库
print("安装requirements.txt中的库")
subprocess.run("venv\\Scripts\\pip.exe install -r ..\\requirements.txt", shell=True)
# 列出pip安装的库
print("列出pip安装的库")
subprocess.run("venv\\Scripts\\pip.exe list", shell=True)
# pyinstaller打包程序
print("pyinstaller打包中")
print("打包main.py")
subprocess.run("venv\\Scripts\\pyinstaller.exe --onefile command\\main.py", shell=True)
print("打包help.py")
subprocess.run("venv\\Scripts\\pyinstaller.exe --onefile command\\help.py", shell=True)
print("打包Download.py")
subprocess.run("venv\\Scripts\\pyinstaller.exe --onefile command\\Download.py", shell=True)
print("打包version.py")
subprocess.run("venv\\Scripts\\pyinstaller.exe --onefile command\\version.py", shell=True)
# 清理build和*.spec文件
print("清理build和*.spec文件")
subprocess.run("RMDIR build /s /q", shell=True)
print("正在清理*.spec文件")
subprocess.run("DEL main.spec version.spec Download.spec help.spec", shell=True)
# 重命名dist为jm_
print("重命名dist为jm_")
dir_path = os.path.dirname(os.path.abspath(__file__))
print("当前路径: " , f"{dir_path}")
pass
os.rename(f"{dir_path}\\dist", "jm_")
# 进入打包后产物文件夹
print("进入打包后产物文件夹")
os.chdir("jm_")
# 测试程序
print("测试程序")
subprocess.run("main.exe", shell=True)
subprocess.run("version.exe", shell=True)
subprocess.run("help.exe", shell=True)
print("大功告成~感谢您的使用")

View File

@@ -1,8 +0,0 @@
import jmcomic as jm
import os, sys
print(f'请输入 jmcomic 车号')
car_id = input()
jm.download_album(car_id)

View File

@@ -1,2 +0,0 @@
print("jm", "{:12}选择你需要下载的漫画".format(" "))
print("version", "{:7}查看当前版本".format(" "))

View File

@@ -1,18 +0,0 @@
import sys, subprocess
# 设定
if len(sys.argv) == 1:
# 如果什么都没输入就输出
subprocess.run("help.exe", check=True)
if len(sys.argv) > 1:
command = sys.argv[1]
if command == "help":
subprocess.run("help.exe", check=True)
elif command == "jm":
subprocess.run("Download.exe", check=True)
elif command == "version":
subprocess.run("version.exe", check=True)
else:
print(f"未知的命令: {command}")

View File

@@ -1,2 +0,0 @@
print("jm_download_python")
print("2026-02-04", "(v0.02)")