From c0740883a0988b2557672874e530b5e596773fa3 Mon Sep 17 00:00:00 2001 From: skimrme Date: Mon, 13 Apr 2026 06:27:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.py | 6 +++ linux/build.py | 63 ------------------------------ linux/command/Download.py | 8 ---- linux/command/help.py | 2 - linux/command/main.py | 18 --------- linux/command/version.py | 2 - mac/build.py | 63 ------------------------------ mac/command/help.py | 2 - mac/command/main.py | 18 --------- mac/command/version.py | 2 - mac/command/Download.py => main.py | 5 ++- windows/build.py | 51 ------------------------ windows/command/Download.py | 8 ---- windows/command/help.py | 2 - windows/command/main.py | 18 --------- windows/command/version.py | 2 - 16 files changed, 10 insertions(+), 260 deletions(-) create mode 100644 build.py delete mode 100644 linux/build.py delete mode 100644 linux/command/Download.py delete mode 100644 linux/command/help.py delete mode 100644 linux/command/main.py delete mode 100644 linux/command/version.py delete mode 100644 mac/build.py delete mode 100644 mac/command/help.py delete mode 100644 mac/command/main.py delete mode 100644 mac/command/version.py rename mac/command/Download.py => main.py (69%) delete mode 100644 windows/build.py delete mode 100644 windows/command/Download.py delete mode 100644 windows/command/help.py delete mode 100644 windows/command/main.py delete mode 100644 windows/command/version.py diff --git a/build.py b/build.py new file mode 100644 index 0000000..036212f --- /dev/null +++ b/build.py @@ -0,0 +1,6 @@ +# 构建文件 + +# 确定系统和架构 +import platform +os_name = platform.system() +print(" 系统名称:", os_name) \ No newline at end of file diff --git a/linux/build.py b/linux/build.py deleted file mode 100644 index 2f7dc5b..0000000 --- a/linux/build.py +++ /dev/null @@ -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 <> 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("大功告成~感谢您的使用") \ No newline at end of file diff --git a/linux/command/Download.py b/linux/command/Download.py deleted file mode 100644 index ddb05fe..0000000 --- a/linux/command/Download.py +++ /dev/null @@ -1,8 +0,0 @@ -import jmcomic as jm -import os, sys - -print(f'请输入 jmcomic 车号') - -car_id = input() - -jm.download_album(car_id) diff --git a/linux/command/help.py b/linux/command/help.py deleted file mode 100644 index e3cf51a..0000000 --- a/linux/command/help.py +++ /dev/null @@ -1,2 +0,0 @@ -print("jm", "{:12}选择你需要下载的漫画".format(" ")) -print("version", "{:7}查看当前版本".format(" ")) \ No newline at end of file diff --git a/linux/command/main.py b/linux/command/main.py deleted file mode 100644 index 275967c..0000000 --- a/linux/command/main.py +++ /dev/null @@ -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}") \ No newline at end of file diff --git a/linux/command/version.py b/linux/command/version.py deleted file mode 100644 index 8e04244..0000000 --- a/linux/command/version.py +++ /dev/null @@ -1,2 +0,0 @@ -print("jm_download_python") -print("2026-02-04", "(v0.02)") \ No newline at end of file diff --git a/mac/build.py b/mac/build.py deleted file mode 100644 index 2f7dc5b..0000000 --- a/mac/build.py +++ /dev/null @@ -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 <> 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("大功告成~感谢您的使用") \ No newline at end of file diff --git a/mac/command/help.py b/mac/command/help.py deleted file mode 100644 index e3cf51a..0000000 --- a/mac/command/help.py +++ /dev/null @@ -1,2 +0,0 @@ -print("jm", "{:12}选择你需要下载的漫画".format(" ")) -print("version", "{:7}查看当前版本".format(" ")) \ No newline at end of file diff --git a/mac/command/main.py b/mac/command/main.py deleted file mode 100644 index 275967c..0000000 --- a/mac/command/main.py +++ /dev/null @@ -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}") \ No newline at end of file diff --git a/mac/command/version.py b/mac/command/version.py deleted file mode 100644 index 8e04244..0000000 --- a/mac/command/version.py +++ /dev/null @@ -1,2 +0,0 @@ -print("jm_download_python") -print("2026-02-04", "(v0.02)") \ No newline at end of file diff --git a/mac/command/Download.py b/main.py similarity index 69% rename from mac/command/Download.py rename to main.py index ddb05fe..d3bb43e 100644 --- a/mac/command/Download.py +++ b/main.py @@ -1,8 +1,11 @@ +# 主函数 +# 引入 jmcomic import jmcomic as jm -import os, sys +# 下载功能 print(f'请输入 jmcomic 车号') car_id = input() jm.download_album(car_id) + diff --git a/windows/build.py b/windows/build.py deleted file mode 100644 index 9080f25..0000000 --- a/windows/build.py +++ /dev/null @@ -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("大功告成~感谢您的使用") \ No newline at end of file diff --git a/windows/command/Download.py b/windows/command/Download.py deleted file mode 100644 index ddb05fe..0000000 --- a/windows/command/Download.py +++ /dev/null @@ -1,8 +0,0 @@ -import jmcomic as jm -import os, sys - -print(f'请输入 jmcomic 车号') - -car_id = input() - -jm.download_album(car_id) diff --git a/windows/command/help.py b/windows/command/help.py deleted file mode 100644 index e3cf51a..0000000 --- a/windows/command/help.py +++ /dev/null @@ -1,2 +0,0 @@ -print("jm", "{:12}选择你需要下载的漫画".format(" ")) -print("version", "{:7}查看当前版本".format(" ")) \ No newline at end of file diff --git a/windows/command/main.py b/windows/command/main.py deleted file mode 100644 index 4e1d63b..0000000 --- a/windows/command/main.py +++ /dev/null @@ -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}") \ No newline at end of file diff --git a/windows/command/version.py b/windows/command/version.py deleted file mode 100644 index 8e04244..0000000 --- a/windows/command/version.py +++ /dev/null @@ -1,2 +0,0 @@ -print("jm_download_python") -print("2026-02-04", "(v0.02)") \ No newline at end of file