40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
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") |