mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-02 20:47:35 +08:00
update linux
This commit is contained in:
parent
2bf2cf6ab2
commit
0688cdbfcd
24
build.py
24
build.py
@ -72,17 +72,23 @@ def build():
|
||||
loading = LoadingAnimation()
|
||||
loading.start("Building in progress")
|
||||
|
||||
# 構建命令
|
||||
os_type = "windows" if os.name == "nt" else "mac"
|
||||
# 根据系统类型设置输出名称
|
||||
system = platform.system().lower()
|
||||
if system == "windows":
|
||||
os_type = "windows"
|
||||
ext = ".exe"
|
||||
elif system == "linux":
|
||||
os_type = "linux"
|
||||
ext = ""
|
||||
else: # Darwin
|
||||
os_type = "mac"
|
||||
ext = ""
|
||||
|
||||
output_name = f"CursorFreeVIP_{version}_{os_type}"
|
||||
|
||||
# 根据操作系统类型设置不同的构建命令和输出路径
|
||||
if os_type == "windows":
|
||||
build_command = f'pyinstaller --clean --noconfirm build.spec'
|
||||
output_path = os.path.join('dist', f'{output_name}.exe')
|
||||
else:
|
||||
build_command = f'pyinstaller --clean --noconfirm build.mac.spec' # 使用 mac 专用的 spec 文件
|
||||
output_path = os.path.join('dist', output_name) # Mac 应用不需要扩展名
|
||||
# 构建命令
|
||||
build_command = f'pyinstaller --clean --noconfirm build.spec'
|
||||
output_path = os.path.join('dist', f'{output_name}{ext}')
|
||||
|
||||
os.system(build_command)
|
||||
|
||||
|
94
build.sh
94
build.sh
@ -1,21 +1,87 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "正在創建虛擬環境..."
|
||||
python3 -m venv venv
|
||||
# 颜色定义
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo "啟動虛擬環境..."
|
||||
source venv/bin/activate
|
||||
# 检查并安装必要的依赖
|
||||
check_dependencies() {
|
||||
echo -e "${YELLOW}检查系统依赖...${NC}"
|
||||
|
||||
# 检查是否为 Ubuntu/Debian
|
||||
if [ -f /etc/debian_version ]; then
|
||||
# 检查并安装必要的包
|
||||
PACKAGES="python3 python3-pip python3-venv"
|
||||
for pkg in $PACKAGES; do
|
||||
if ! dpkg -l | grep -q "^ii $pkg "; then
|
||||
echo -e "${YELLOW}安装 $pkg...${NC}"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y $pkg
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "${RED}不支持的系统,请手动安装 python3, pip3 和 python3-venv${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "安裝依賴..."
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
# 创建并激活虚拟环境
|
||||
setup_venv() {
|
||||
echo -e "${GREEN}正在创建虚拟环境...${NC}"
|
||||
python3 -m venv venv
|
||||
|
||||
echo -e "${GREEN}启动虚拟环境...${NC}"
|
||||
. ./venv/bin/activate || source ./venv/bin/activate
|
||||
}
|
||||
|
||||
echo "開始構建..."
|
||||
python build.py
|
||||
# 安装依赖
|
||||
install_dependencies() {
|
||||
echo -e "${GREEN}安装依赖...${NC}"
|
||||
python3 -m pip install --upgrade pip
|
||||
pip3 install -r requirements.txt
|
||||
}
|
||||
|
||||
echo "清理虛擬環境..."
|
||||
deactivate
|
||||
rm -rf venv
|
||||
# 构建程序
|
||||
build_program() {
|
||||
echo -e "${GREEN}开始构建...${NC}"
|
||||
python3 build.py
|
||||
}
|
||||
|
||||
echo "完成!"
|
||||
read -p "按任意鍵退出..."
|
||||
# 清理
|
||||
cleanup() {
|
||||
echo -e "${GREEN}清理虚拟环境...${NC}"
|
||||
deactivate 2>/dev/null || true
|
||||
rm -rf venv
|
||||
}
|
||||
|
||||
# 主程序
|
||||
main() {
|
||||
# 检查依赖
|
||||
check_dependencies
|
||||
|
||||
# 设置虚拟环境
|
||||
setup_venv
|
||||
|
||||
# 安装依赖
|
||||
install_dependencies
|
||||
|
||||
# 构建
|
||||
build_program
|
||||
|
||||
# 清理
|
||||
cleanup
|
||||
|
||||
echo -e "${GREEN}完成!${NC}"
|
||||
echo "按任意键退出..."
|
||||
# 使用兼容的方式读取输入
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
read dummy
|
||||
else
|
||||
read -n 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 运行主程序
|
||||
main
|
14
build.spec
14
build.spec
@ -1,11 +1,21 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
import os
|
||||
import platform
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# 加載環境變量獲取版本號
|
||||
load_dotenv()
|
||||
version = os.getenv('VERSION', '1.0.0')
|
||||
os_type = "windows" if os.name == "nt" else "mac"
|
||||
|
||||
# 根据系统类型设置输出名称
|
||||
system = platform.system().lower()
|
||||
if system == "windows":
|
||||
os_type = "windows"
|
||||
elif system == "linux":
|
||||
os_type = "linux"
|
||||
else: # Darwin
|
||||
os_type = "mac"
|
||||
|
||||
output_name = f"CursorFreeVIP_{version}_{os_type}"
|
||||
|
||||
a = Analysis(
|
||||
@ -45,7 +55,7 @@ exe = EXE(
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name=output_name,
|
||||
name=output_name, # 使用动态生成的名称
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
|
25
logo.py
Normal file
25
logo.py
Normal file
@ -0,0 +1,25 @@
|
||||
from colorama import Fore, Style, init
|
||||
# 初始化 colorama
|
||||
init()
|
||||
|
||||
CURSOR_LOGO = f"""
|
||||
{Fore.CYAN}
|
||||
██████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗
|
||||
██╔════╝██║ ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗ ██╔══██╗██╔══██╗██╔═══██╗
|
||||
██║ ██║ ██║██████╔╝███████╗██║ ██║██████╔╝ ██████╔╝██████╔╝██║ ██║
|
||||
██║ ██║ ██║██╔══██╗╚════██║██║ ██║██╔══██╗ ██╔═══╝ ██╔══██╗██║ ██║
|
||||
╚██████╗╚██████╔╝██║ ██║███████║╚██████╔╝██║ ██║ ██║ ██║ ██║╚██████╔╝
|
||||
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝
|
||||
{Fore.YELLOW}
|
||||
Pro Version Activator
|
||||
{Fore.GREEN}
|
||||
Author: Pin Studios | yeongpin
|
||||
{Style.RESET_ALL}
|
||||
"""
|
||||
|
||||
def print_logo():
|
||||
print(CURSOR_LOGO)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print_logo()
|
8
requirements.txt
Normal file
8
requirements.txt
Normal file
@ -0,0 +1,8 @@
|
||||
watchdog
|
||||
python-dotenv>=1.0.0
|
||||
colorama>=0.4.6
|
||||
requests
|
||||
psutil>=5.8.0
|
||||
pywin32; platform_system == "Windows"
|
||||
pyinstaller
|
||||
DrissionPage>=4.0.0
|
Loading…
x
Reference in New Issue
Block a user