File tree 5 files changed +140
-25
lines changed
5 files changed +140
-25
lines changed Original file line number Diff line number Diff line change @@ -72,17 +72,23 @@ def build():
72
72
loading = LoadingAnimation ()
73
73
loading .start ("Building in progress" )
74
74
75
- # 構建命令
76
- os_type = "windows" if os .name == "nt" else "mac"
75
+ # 根据系统类型设置输出名称
76
+ system = platform .system ().lower ()
77
+ if system == "windows" :
78
+ os_type = "windows"
79
+ ext = ".exe"
80
+ elif system == "linux" :
81
+ os_type = "linux"
82
+ ext = ""
83
+ else : # Darwin
84
+ os_type = "mac"
85
+ ext = ""
86
+
77
87
output_name = f"CursorFreeVIP_{ version } _{ os_type } "
78
88
79
- # 根据操作系统类型设置不同的构建命令和输出路径
80
- if os_type == "windows" :
81
- build_command = f'pyinstaller --clean --noconfirm build.spec'
82
- output_path = os .path .join ('dist' , f'{ output_name } .exe' )
83
- else :
84
- build_command = f'pyinstaller --clean --noconfirm build.mac.spec' # 使用 mac 专用的 spec 文件
85
- output_path = os .path .join ('dist' , output_name ) # Mac 应用不需要扩展名
89
+ # 构建命令
90
+ build_command = f'pyinstaller --clean --noconfirm build.spec'
91
+ output_path = os .path .join ('dist' , f'{ output_name } { ext } ' )
86
92
87
93
os .system (build_command )
88
94
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- echo " 正在創建虛擬環境..."
4
- python3 -m venv venv
3
+ # 颜色定义
4
+ RED=' \033[0;31m'
5
+ GREEN=' \033[0;32m'
6
+ YELLOW=' \033[1;33m'
7
+ NC=' \033[0m' # No Color
5
8
6
- echo " 啟動虛擬環境..."
7
- source venv/bin/activate
9
+ # 检查并安装必要的依赖
10
+ check_dependencies () {
11
+ echo -e " ${YELLOW} 检查系统依赖...${NC} "
12
+
13
+ # 检查是否为 Ubuntu/Debian
14
+ if [ -f /etc/debian_version ]; then
15
+ # 检查并安装必要的包
16
+ PACKAGES=" python3 python3-pip python3-venv"
17
+ for pkg in $PACKAGES ; do
18
+ if ! dpkg -l | grep -q " ^ii $pkg " ; then
19
+ echo -e " ${YELLOW} 安装 $pkg ...${NC} "
20
+ sudo apt-get update
21
+ sudo apt-get install -y $pkg
22
+ fi
23
+ done
24
+ else
25
+ echo -e " ${RED} 不支持的系统,请手动安装 python3, pip3 和 python3-venv${NC} "
26
+ exit 1
27
+ fi
28
+ }
8
29
9
- echo " 安裝依賴..."
10
- python -m pip install --upgrade pip
11
- pip install -r requirements.txt
30
+ # 创建并激活虚拟环境
31
+ setup_venv () {
32
+ echo -e " ${GREEN} 正在创建虚拟环境...${NC} "
33
+ python3 -m venv venv
34
+
35
+ echo -e " ${GREEN} 启动虚拟环境...${NC} "
36
+ . ./venv/bin/activate || source ./venv/bin/activate
37
+ }
12
38
13
- echo " 開始構建..."
14
- python build.py
39
+ # 安装依赖
40
+ install_dependencies () {
41
+ echo -e " ${GREEN} 安装依赖...${NC} "
42
+ python3 -m pip install --upgrade pip
43
+ pip3 install -r requirements.txt
44
+ }
15
45
16
- echo " 清理虛擬環境..."
17
- deactivate
18
- rm -rf venv
46
+ # 构建程序
47
+ build_program () {
48
+ echo -e " ${GREEN} 开始构建...${NC} "
49
+ python3 build.py
50
+ }
19
51
20
- echo " 完成!"
21
- read -p " 按任意鍵退出..."
52
+ # 清理
53
+ cleanup () {
54
+ echo -e " ${GREEN} 清理虚拟环境...${NC} "
55
+ deactivate 2> /dev/null || true
56
+ rm -rf venv
57
+ }
58
+
59
+ # 主程序
60
+ main () {
61
+ # 检查依赖
62
+ check_dependencies
63
+
64
+ # 设置虚拟环境
65
+ setup_venv
66
+
67
+ # 安装依赖
68
+ install_dependencies
69
+
70
+ # 构建
71
+ build_program
72
+
73
+ # 清理
74
+ cleanup
75
+
76
+ echo -e " ${GREEN} 完成!${NC} "
77
+ echo " 按任意键退出..."
78
+ # 使用兼容的方式读取输入
79
+ if [ " $( uname) " = " Linux" ]; then
80
+ read dummy
81
+ else
82
+ read -n 1
83
+ fi
84
+ }
85
+
86
+ # 运行主程序
87
+ main
Original file line number Diff line number Diff line change 1
1
# -*- mode: python ; coding: utf-8 -*-
2
2
import os
3
+ import platform
3
4
from dotenv import load_dotenv
4
5
5
6
# 加載環境變量獲取版本號
6
7
load_dotenv ()
7
8
version = os .getenv ('VERSION' , '1.0.0' )
8
- os_type = "windows" if os .name == "nt" else "mac"
9
+
10
+ # 根据系统类型设置输出名称
11
+ system = platform .system ().lower ()
12
+ if system == "windows" :
13
+ os_type = "windows"
14
+ elif system == "linux" :
15
+ os_type = "linux"
16
+ else : # Darwin
17
+ os_type = "mac"
18
+
9
19
output_name = f"CursorFreeVIP_{ version } _{ os_type } "
10
20
11
21
a = Analysis (
@@ -45,7 +55,7 @@ exe = EXE(
45
55
a .binaries ,
46
56
a .datas ,
47
57
[],
48
- name = output_name ,
58
+ name = output_name , # 使用动态生成的名称
49
59
debug = False ,
50
60
bootloader_ignore_signals = False ,
51
61
strip = False ,
Original file line number Diff line number Diff line change
1
+ from colorama import Fore , Style , init
2
+ # 初始化 colorama
3
+ init ()
4
+
5
+ CURSOR_LOGO = f"""
6
+ { Fore .CYAN }
7
+ ██████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗
8
+ ██╔════╝██║ ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔═══██╗
9
+ ██║ ██║ ██║██████╔╝███████╗██║ ██║██████╔╝ ██████╔╝██████╔╝██║ ██║
10
+ ██║ ██║ ██║██╔══██╗╚════██║██║ ██║██╔══██╗ ██╔═══╝ ██╔══██╗██║ ██║
11
+ ╚██████╗╚██████╔╝██║ ██║███████║╚██████╔╝██║ ██║ ██║ ██║ ██║╚██████╔╝
12
+ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝
13
+ { Fore .YELLOW }
14
+ Pro Version Activator
15
+ { Fore .GREEN }
16
+ Author: Pin Studios | yeongpin
17
+ { Style .RESET_ALL }
18
+ """
19
+
20
+ def print_logo ():
21
+ print (CURSOR_LOGO )
22
+
23
+
24
+ if __name__ == "__main__" :
25
+ print_logo ()
Original file line number Diff line number Diff line change
1
+ watchdog
2
+ python-dotenv >= 1.0.0
3
+ colorama >= 0.4.6
4
+ requests
5
+ psutil >= 5.8.0
6
+ pywin32 ; platform_system == "Windows"
7
+ pyinstaller
8
+ DrissionPage >= 4.0.0
You can’t perform that action at this time.
0 commit comments