Implement build system for Cursor Pro with platform-specific packaging
- Added build.py script to automate the packaging process for macOS and Windows. - Created CursorKeepAlive.mac.spec and CursorKeepAlive.win.spec for application specifications. - Updated .gitignore to exclude build artifacts and IDE files. - Enhanced directory structure for output files and included configuration file handling in the build process.
This commit is contained in:
35
build.py
Normal file
35
build.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
def build():
|
||||
system = platform.system().lower()
|
||||
|
||||
if system == 'darwin':
|
||||
spec_file = 'CursorKeepAlive.mac.spec'
|
||||
output_dir = 'dist/mac'
|
||||
elif system == 'windows':
|
||||
spec_file = 'CursorKeepAlive.win.spec'
|
||||
output_dir = 'dist/windows'
|
||||
else:
|
||||
print(f"不支持的操作系统: {system}")
|
||||
return
|
||||
|
||||
# 创建输出目录
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# 运行 PyInstaller
|
||||
subprocess.run(['pyinstaller', spec_file, '--distpath', output_dir, '--workpath', f'build/{system}'])
|
||||
|
||||
# 复制配置文件
|
||||
if os.path.exists('config.ini'):
|
||||
if system == 'darwin':
|
||||
os.makedirs(f'{output_dir}/CursorPro.app/Contents/MacOS', exist_ok=True)
|
||||
subprocess.run(['cp', 'config.ini', f'{output_dir}/CursorPro.app/Contents/MacOS/'])
|
||||
else:
|
||||
subprocess.run(['cp', 'config.ini', output_dir])
|
||||
|
||||
print(f"构建完成,输出目录: {output_dir}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
build()
|
||||
Reference in New Issue
Block a user