Skip to content

Commit 0688cdb

Browse files
committed
update linux
1 parent 2bf2cf6 commit 0688cdb

File tree

5 files changed

+140
-25
lines changed

5 files changed

+140
-25
lines changed

build.py

+15-9
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,23 @@ def build():
7272
loading = LoadingAnimation()
7373
loading.start("Building in progress")
7474

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+
7787
output_name = f"CursorFreeVIP_{version}_{os_type}"
7888

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}')
8692

8793
os.system(build_command)
8894

build.sh

+80-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,87 @@
11
#!/bin/bash
22

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
58

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+
}
829

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+
}
1238

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+
}
1545

16-
echo "清理虛擬環境..."
17-
deactivate
18-
rm -rf venv
46+
# 构建程序
47+
build_program() {
48+
echo -e "${GREEN}开始构建...${NC}"
49+
python3 build.py
50+
}
1951

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

build.spec

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
# -*- mode: python ; coding: utf-8 -*-
22
import os
3+
import platform
34
from dotenv import load_dotenv
45

56
# 加載環境變量獲取版本號
67
load_dotenv()
78
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+
919
output_name = f"CursorFreeVIP_{version}_{os_type}"
1020

1121
a = Analysis(
@@ -45,7 +55,7 @@ exe = EXE(
4555
a.binaries,
4656
a.datas,
4757
[],
48-
name=output_name,
58+
name=output_name, # 使用动态生成的名称
4959
debug=False,
5060
bootloader_ignore_signals=False,
5161
strip=False,

logo.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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()

requirements.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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

0 commit comments

Comments
 (0)