修复一个愚蠢的错误:编译时会删除/目录!!!

pull/105/head
Apex Liu 2017-11-25 02:39:52 +08:00
parent f56277fc30
commit b5c86b94fa
3 changed files with 10 additions and 16 deletions

View File

@ -7,7 +7,6 @@ from core.env import env
ctx = BuildContext()
with_rdp = os.path.exists(os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'rdp'))
with_telnet = os.path.exists(os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'telnet'))
class BuilderBase:
@ -70,9 +69,9 @@ class BuilderLinux(BuilderBase):
out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, 'bin')
out_files = [os.path.join(out_path, 'tp_core'), os.path.join(out_path, 'tp_web')]
out_files.extend(os.path.join(out_path, 'libtpssh.so'))
out_files.append(os.path.join(out_path, 'libtpssh.so'))
if with_rdp:
out_files.extend(os.path.join(out_path, 'libtprdp.so'))
out_files.append(os.path.join(out_path, 'libtprdp.so'))
# out_files.extend(os.path.join(out_path, 'libtptelnet.so'))
for f in out_files:
@ -98,9 +97,9 @@ class BuilderMacOS(BuilderBase):
out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, 'bin')
out_files = [os.path.join(out_path, 'tp_core'), os.path.join(out_path, 'tp_web')]
out_files.extend(os.path.join(out_path, 'libtpssh.so'))
out_files.append(os.path.join(out_path, 'libtpssh.so'))
if with_rdp:
out_files.extend(os.path.join(out_path, 'libtprdp.so'))
out_files.append(os.path.join(out_path, 'libtprdp.so'))
# out_files.extend(os.path.join(out_path, 'libtptelnet.so'))
for f in out_files:
@ -155,15 +154,6 @@ def main():
if 'server' in argv:
builder.build_server()
# if 'app' in argv:
# builder.build_app()
# if 'installer' in argv:
# builder.build_installer()
# if 'runtime' in argv:
# builder.build_runtime()
if __name__ == '__main__':
try:

View File

@ -9,6 +9,7 @@ import time
import platform
from . import colorconsole as cc
from . import utils
rm_file_every_level = ['.pyc', '.pyo']
@ -47,7 +48,8 @@ def remove_cache(path):
for d in dir_list:
d = d.lower()
if d == '__pycache__':
shutil.rmtree(os.path.join(parent, d))
# shutil.rmtree(os.path.join(parent, d))
utils.remove(os.path.join(parent, d))
continue
remove_cache(os.path.join(parent, d))

View File

@ -107,7 +107,7 @@ def extension_suffixes():
def remove(*args):
path = os.path.join(*args)
path = os.path.abspath(os.path.join(*args))
cc.v('remove [%s] ...' % path, end='')
if not os.path.exists(path):
@ -118,6 +118,8 @@ def remove(*args):
cc.v('.', end='')
try:
if os.path.isdir(path):
if path == '/':
raise RuntimeError('### What are you doing?!! ###')
shutil.rmtree(path, ignore_errors=True)
time.sleep(0.5)
else: