19 lines
642 B
Python
19 lines
642 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""打包后端修复文件"""
|
||
|
|
import tarfile
|
||
|
|
import os
|
||
|
|
|
||
|
|
base_dir = r"D:\资料\03-项目开发\wecom_it_smart_desk"
|
||
|
|
# 打包时直接用 tasks/h5_ai_task.py 作为文件名
|
||
|
|
files_to_pack = [r"backend\app\tasks\h5_ai_task.py"]
|
||
|
|
tar_path = r"C:\tmp\h5_ai_task_fix.tar.gz"
|
||
|
|
|
||
|
|
with tarfile.open(tar_path, 'w:gz') as tar:
|
||
|
|
for f in files_to_pack:
|
||
|
|
full_path = os.path.join(base_dir, f)
|
||
|
|
# 使用 tasks/h5_ai_task.py 作为arcname,这样解压后会直接覆盖
|
||
|
|
tar.add(full_path, arcname="tasks/h5_ai_task.py")
|
||
|
|
|
||
|
|
print(f'打包完成: {tar_path}')
|
||
|
|
print(f'大小: {os.path.getsize(tar_path)} bytes')
|