wine-runner-list/upload.py

40 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import sys
import json
import datetime
datetime.datetime.now().year
fileName = os.path.basename(sys.argv[1])
fileMainName = os.path.splitext(fileName)[0]
if "http:" in sys.argv[1] or "https://" in sys.argv[1]:
url = sys.argv[1]
else:
url = f"https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/other/{fileName}?gfdgd_xi=gfdgd_xi"
os.system(f"cp -rv '{sys.argv[1]}' other")
command = f'''#!/usr/bin/env deepin-wine-runner-auto-install-bash
# 使用 Wine 运行器的语言解析器
##########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 更新时间:{datetime.datetime.now().year}{datetime.datetime.now().month}{datetime.datetime.now().day}
##########################################################################################
# 用于判断是否为 bash 解释器
if [[ 1 == 2 ]]; then
# 保持对旧版本的兼容
bash rm "/tmp/{fileName}"
fi
rm "/tmp/{fileName}"
download "{url}" /tmp "{fileName}"
bat "/tmp/{fileName}"
info 提示 安装完成!'''
with open("auto/list.json", "r") as file:
lists = json.loads(file.read())
#lists = []
lists.insert(1, [f"安装 {sys.argv[2]}", f"{fileMainName}.sh"])
with open("auto/list.json", "w") as file:
file.write(json.dumps(lists, ensure_ascii=False, indent=4))
with open(f"auto/{fileMainName}.sh", "w") as file:
file.write(command)
#print(command)
#exit()
os.system("git add .")
os.system(f"git commit -m '新增程序 {sys.argv[2]}'")
os.system("git push")