Skip to content

Commit 12317b5

Browse files
committed
✨ feat: 添加ffmpeg二进制文件并更新构建配置
- 将ffmpeg.exe添加到assets目录并包含LICENSE - 更新.gitignore以忽略日志文件 - 修改SimpleCutPy.spec以包含ffmpeg二进制文件 - 升级项目版本至0.4.3并添加pyinstaller开发依赖 - 创建构建脚本scripts/build.py - 使用uv替代pip进行依赖管理 - 更新CI工作流使用uv - 重构代码结构并修复ffmpeg路径处理
1 parent 9e525c3 commit 12317b5

File tree

12 files changed

+1000
-119
lines changed

12 files changed

+1000
-119
lines changed

.github/workflows/build-and-release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,19 @@ jobs:
3131
ffmpeg-version: "6.0"
3232
architecture: "x64"
3333

34+
- name: Install uv
35+
uses: astral-sh/setup-uv@v2
36+
with:
37+
version: latest
38+
enable-cache: true
39+
3440
- name: Install dependencies
3541
run: |
36-
python -m pip install --upgrade pip
37-
pip install -e .
38-
pip install pyinstaller
42+
uv sync
3943
4044
- name: Build with PyInstaller
4145
run: |
42-
pyinstaller SimpleCutPy.spec
46+
uv run pyinstaller SimpleCutPy.spec
4347
4448
- name: Upload build artifacts
4549
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
build/**
2-
dist/**
3-
.venv/**
4-
.idea/**
5-
**/__pycache__/**
6-
.vscode/
1+
build/
2+
dist/
3+
.venv/
4+
.idea/
5+
**/__pycache__/
6+
.vscode/
7+
/**/SimpleCut.log

SimpleCutPy.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
a = Analysis(
5-
['src\main.py'],
5+
['src/main.py'],
66
pathex=['src'],
7-
binaries=[],
7+
binaries=[('assets/ffmpeg.exe', 'assets')],
88
datas=[],
99
hiddenimports=['wx', 'src', 'pymediainfo'],
1010
hookspath=[],

assets/LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

assets/ffmpeg.exe

29.9 MB
Binary file not shown.

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[project]
22
name = "simplecutpy"
3-
version = "0.3.0"
3+
version = "0.4.3"
44
description = "A simple video cut tool based on wxpython, ffmpeg"
55
readme = "README.md"
66
requires-python = "==3.12.*"
7-
dependencies = [
8-
"logging>=0.4.9.6",
9-
"pymediainfo>=7.0.1",
10-
"wxpython>=4.2.2",
7+
dependencies = ["logging>=0.4.9.6", "pymediainfo>=7.0.1", "wxpython>=4.2.2"]
8+
9+
[dependency-groups]
10+
dev = [
11+
"pyinstaller>=6.17.0",
1112
]

scripts/build.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python
2+
import os
3+
import subprocess
4+
import sys
5+
6+
def main():
7+
"""Simple build script for SimpleCutPy"""
8+
print("SimpleCutPy Build Script")
9+
print("========================================")
10+
11+
# Change to project root directory
12+
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
13+
os.chdir(project_root)
14+
15+
# Clean build directories
16+
print("Cleaning build directories...")
17+
for dir_name in ["build", "dist"]:
18+
dir_path = os.path.join(project_root, dir_name)
19+
if os.path.exists(dir_path):
20+
import shutil
21+
shutil.rmtree(dir_path)
22+
print(f" ✅ Cleaned {dir_name} directory")
23+
24+
# Install dependencies
25+
print("Installing dependencies...")
26+
result = subprocess.run(["uv", "sync"], check=True)
27+
if result.returncode != 0:
28+
print("❌ Dependency installation failed")
29+
sys.exit(1)
30+
31+
# Build application
32+
print("Building application...")
33+
result = subprocess.run(["pyinstaller", "SimpleCutPy.spec"], check=True)
34+
if result.returncode != 0:
35+
print("❌ Application build failed")
36+
sys.exit(1)
37+
38+
# Check build result
39+
print("Checking build result...")
40+
exe_path = os.path.join(project_root, "dist", "SimpleCutPy.exe")
41+
if os.path.exists(exe_path):
42+
print(f"✅ Build successful: {exe_path}")
43+
else:
44+
print("❌ Build failed: Executable not found")
45+
sys.exit(1)
46+
47+
print("Build completed!")
48+
49+
if __name__ == "__main__":
50+
main()

0 commit comments

Comments
 (0)