#!/usr/bin/env python3 """打包 P2/P3 部署文件""" import os import tarfile # 待上传的后端文件 backend_files = [ 'backend/app/utils/token_counter.py', 'backend/app/services/automation/context_compressor.py', 'backend/app/services/automation/snapshot_service.py', 'backend/app/services/automation/correction_service.py', 'backend/alembic/versions/049_add_p2_p3_tables.py', 'backend/tests/test_p2_p3.py', # 修改的文件 'backend/app/models/automation.py', 'backend/app/constants.py', 'backend/app/config.py', 'backend/app/schemas/automation.py', 'backend/app/api/automation.py', ] # 创建临时打包 with tarfile.open('backend-p2-p3-deploy.tar.gz', 'w:gz') as tar: for f in backend_files: if os.path.exists(f): tar.add(f, arcname=f) print(f'Added: {f}') else: print(f'NOT FOUND: {f}') print('Done!')