代码拉取完成,页面将自动刷新
同步操作将从 Plato/plato 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import subprocess
import platform
import os
import sys
import json
import shutil
def get_pyexec():
print(sys.executable)
return sys.executable
def getCurrentRepo():
BINPATH = os.path.abspath(os.path.dirname(__file__)).replace('\\', '/')
setting_path = os.path.join(BINPATH, '.settings', 'repo-settings.json')
if not os.path.exists(setting_path):
return None
json_str = open(setting_path, 'r', encoding='utf-8').read()
if len(json_str) == 0:
print("repo-settings.json corruption")
exit(-1)
settings = json.loads(open(setting_path, 'r', encoding='utf-8').read())
if len(settings['cur_repo']) == 0:
return None
return settings['cur_repo'].replace('\\', '/')
def do_command(type):
cur_repo = getCurrentRepo()
if cur_repo is None:
print("No repo")
exit(-1)
REPO_ROOT = cur_repo.replace("\\", "/")
PYEXEC = get_pyexec()
#cmd = PYEXEC +" "+REPO_ROOT+"/repo.py -t "+type+" "
arg_list = [PYEXEC, REPO_ROOT+"/repo.py", "-t", type]
arg_list.extend(sys.argv[1:])
cmd = subprocess.Popen(arg_list, encoding='utf-8')
ret = cmd.communicate()
if cmd.returncode != 0:
print(type, " failed")
print("err message:", [ line.decode("utf-8") for line in ret if line is not None])
return
#os.system(cmd + ' '.join(sys.argv[1:]))
def switchRepo(repo_path):
BINPATH = os.path.abspath(os.path.dirname(__file__)).replace('\\', '/')
setting_path = os.path.join(BINPATH, '.settings', 'repo-settings.json')
if not os.path.exists(setting_path):
return
json_str = open(setting_path, 'r', encoding='utf-8').read()
if len(json_str) == 0:
print("repo-settings.json corruption")
exit(-1)
settings = json.loads(json_str)
settings['cur_repo'] = repo_path
open(setting_path, 'w', encoding='utf-8').write(json.dumps(settings))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。