Spaces:
Sleeping
Sleeping
fix auto upgrade issue
Browse files- check_proxy.py +5 -7
check_proxy.py
CHANGED
@@ -56,26 +56,24 @@ def patch_and_restart(path):
|
|
56 |
"""
|
57 |
一键更新协议:覆盖和重启
|
58 |
"""
|
59 |
-
import
|
60 |
import shutil
|
61 |
import os
|
62 |
import sys
|
63 |
import time
|
|
|
64 |
from colorful import print亮黄, print亮绿, print亮红
|
65 |
# if not using config_private, move origin config.py as config_private.py
|
66 |
if not os.path.exists('config_private.py'):
|
67 |
print亮黄('由于您没有设置config_private.py私密配置,现将您的现有配置移动至config_private.py以防止配置丢失,',
|
68 |
'另外您可以随时在history子文件夹下找回旧版的程序。')
|
69 |
shutil.copyfile('config.py', 'config_private.py')
|
70 |
-
|
71 |
-
|
72 |
-
except:
|
73 |
-
from distutils import dir_util
|
74 |
-
dir_util.copy_tree(path+'/gpt_academic-master', './')
|
75 |
-
import subprocess
|
76 |
print亮绿('代码已经更新,即将更新pip包依赖……')
|
77 |
for i in reversed(range(5)): time.sleep(1); print(i)
|
78 |
try:
|
|
|
79 |
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
|
80 |
except:
|
81 |
print亮红('pip包依赖安装出现问题,需要手动安装新增的依赖库 `python -m pip install -r requirements.txt`,然后在用常规的`python main.py`的方式启动。')
|
|
|
56 |
"""
|
57 |
一键更新协议:覆盖和重启
|
58 |
"""
|
59 |
+
from distutils import dir_util
|
60 |
import shutil
|
61 |
import os
|
62 |
import sys
|
63 |
import time
|
64 |
+
import glob
|
65 |
from colorful import print亮黄, print亮绿, print亮红
|
66 |
# if not using config_private, move origin config.py as config_private.py
|
67 |
if not os.path.exists('config_private.py'):
|
68 |
print亮黄('由于您没有设置config_private.py私密配置,现将您的现有配置移动至config_private.py以防止配置丢失,',
|
69 |
'另外您可以随时在history子文件夹下找回旧版的程序。')
|
70 |
shutil.copyfile('config.py', 'config_private.py')
|
71 |
+
path_new_version = glob.glob(path + '/*-master')[0]
|
72 |
+
dir_util.copy_tree(path_new_version, './')
|
|
|
|
|
|
|
|
|
73 |
print亮绿('代码已经更新,即将更新pip包依赖……')
|
74 |
for i in reversed(range(5)): time.sleep(1); print(i)
|
75 |
try:
|
76 |
+
import subprocess
|
77 |
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
|
78 |
except:
|
79 |
print亮红('pip包依赖安装出现问题,需要手动安装新增的依赖库 `python -m pip install -r requirements.txt`,然后在用常规的`python main.py`的方式启动。')
|