mirror of https://github.com/tp4a/teleport
.fix build script for macOS.
parent
47c1c207ea
commit
140b034f50
|
@ -54,7 +54,6 @@ class BuilderBase:
|
|||
return False
|
||||
else:
|
||||
return True
|
||||
# cc.e("this is a pure-virtual function.")
|
||||
|
||||
def build_libuv(self):
|
||||
file_name = 'libuv-{}.zip'.format(env.ver_libuv)
|
||||
|
@ -89,15 +88,6 @@ class BuilderBase:
|
|||
def _prepare_python(self):
|
||||
cc.e("this is a pure-virtual function.")
|
||||
|
||||
# def build_sqlite(self):
|
||||
# file_name = 'sqlite-autoconf-{}.tar.gz'.format(env.ver_sqlite)
|
||||
# if not utils.download_file('sqlite source tarball', 'http://sqlite.org/2017/{}'.format(file_name), PATH_DOWNLOAD, file_name):
|
||||
# return
|
||||
# self._build_sqlite(file_name)
|
||||
#
|
||||
# def _build_sqlite(self, file_name):
|
||||
# cc.e("this is a pure-virtual function.")
|
||||
|
||||
def fix_output(self):
|
||||
pass
|
||||
|
||||
|
@ -112,11 +102,8 @@ class BuilderWin(BuilderBase):
|
|||
self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose')
|
||||
self.MBEDTLS_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mbedtls')
|
||||
self.LIBUV_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libuv')
|
||||
# self.LIBSSH_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libssh-win-static')
|
||||
self.LIBSSH_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libssh')
|
||||
|
||||
# self._prepare_python_header()
|
||||
|
||||
def _prepare_python(self):
|
||||
cc.n('prepare python header files ...', end='')
|
||||
|
||||
|
@ -125,12 +112,6 @@ class BuilderWin(BuilderBase):
|
|||
return
|
||||
cc.v('')
|
||||
|
||||
# if os.path.exists(os.path.join(env.path_py_inc, 'Python.h')):
|
||||
# cc.e('can not locate python development include path, make sure miniconda installed.')
|
||||
# return
|
||||
# cc.v('')
|
||||
# utils.copy_ex(env.path_py_inc, os.path.join(PATH_EXTERNAL, 'python', 'include'))
|
||||
|
||||
_header_path = None
|
||||
for p in sys.path:
|
||||
if os.path.exists(os.path.join(p, 'include', 'Python.h')):
|
||||
|
@ -147,8 +128,6 @@ class BuilderWin(BuilderBase):
|
|||
cc.n('build openssl static library from source code... ')
|
||||
|
||||
if not super()._build_openssl(file_name):
|
||||
# _alt_ver = '_'.join(env.ver_ossl.split('.'))
|
||||
# if not utils.download_file('openssl source tarball', 'https://github.com/openssl/openssl/archive/OpenSSL_{}.zip'.format(_alt_ver), PATH_DOWNLOAD, file_name):
|
||||
return
|
||||
|
||||
_chk_output = [
|
||||
|
@ -273,10 +252,6 @@ class BuilderWin(BuilderBase):
|
|||
else:
|
||||
cc.w('already exists, skip.')
|
||||
|
||||
# def build_sqlite(self):
|
||||
# cc.w('sqlite not need for Windows, skip.')
|
||||
# pass
|
||||
|
||||
def fix_output(self):
|
||||
pass
|
||||
|
||||
|
@ -288,11 +263,9 @@ class BuilderLinux(BuilderBase):
|
|||
def _init_path(self):
|
||||
self.PATH_TMP = os.path.join(PATH_EXTERNAL, 'linux', 'tmp')
|
||||
self.PATH_RELEASE = os.path.join(PATH_EXTERNAL, 'linux', 'release')
|
||||
# self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-{}'.format(env.ver_ossl))
|
||||
self.LIBUV_PATH_SRC = os.path.join(self.PATH_TMP, 'libuv-{}'.format(env.ver_libuv))
|
||||
self.MBEDTLS_PATH_SRC = os.path.join(self.PATH_TMP, 'mbedtls-mbedtls-{}'.format(env.ver_mbedtls))
|
||||
self.LIBSSH_PATH_SRC = os.path.join(self.PATH_TMP, 'libssh-{}'.format(env.ver_libssh))
|
||||
# self.SQLITE_PATH_SRC = os.path.join(self.PATH_TMP, 'sqlite-autoconf-{}'.format(env.ver_sqlite))
|
||||
|
||||
self.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp')
|
||||
self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose')
|
||||
|
@ -307,8 +280,6 @@ class BuilderLinux(BuilderBase):
|
|||
cc.w(' - header file already exists, skip.')
|
||||
else:
|
||||
utils.ensure_file_exists(os.path.join(self.PATH_RELEASE, 'include', 'python{}m'.format(ctx.py_dot_ver), 'Python.h'))
|
||||
# utils.makedirs(os.path.join(self.PATH_RELEASE, 'include'))
|
||||
# utils.copy_ex(env.path_py_inc, os.path.join(self.PATH_RELEASE, 'include', 'python'))
|
||||
utils.sys_exec('ln -s "{}" "{}"'.format(
|
||||
os.path.join(self.PATH_RELEASE, 'include', 'python{}m'.format(ctx.py_dot_ver)),
|
||||
os.path.join(self.PATH_RELEASE, 'include', 'python')
|
||||
|
@ -316,13 +287,6 @@ class BuilderLinux(BuilderBase):
|
|||
|
||||
lib_file = 'libpython{}m.a'.format(env.py_ver_dot)
|
||||
utils.ensure_file_exists(os.path.join(self.PATH_RELEASE, 'lib', lib_file))
|
||||
# if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', lib_file)):
|
||||
# cc.w(' - lib file already exists, skip.')
|
||||
# else:
|
||||
# utils.makedirs(os.path.join(self.PATH_RELEASE, 'lib'))
|
||||
# utils.copy_file(env.path_py_lib, os.path.join(self.PATH_RELEASE, 'lib'), lib_file)
|
||||
# utils.copy_file(env.path_py_lib, os.path.join(self.PATH_RELEASE, 'lib'), 'libcrypto.a')
|
||||
# utils.copy_file(env.path_py_lib, os.path.join(self.PATH_RELEASE, 'lib'), 'libssl.a')
|
||||
|
||||
def _build_jsoncpp(self, file_name):
|
||||
cc.n('prepare jsoncpp source code...', end='')
|
||||
|
@ -347,7 +311,6 @@ class BuilderLinux(BuilderBase):
|
|||
|
||||
def _build_libuv(self, file_name):
|
||||
if not os.path.exists(self.LIBUV_PATH_SRC):
|
||||
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
|
||||
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||
|
||||
cc.n('build libuv...', end='')
|
||||
|
@ -375,7 +338,6 @@ class BuilderLinux(BuilderBase):
|
|||
|
||||
def _build_mbedtls(self, file_name):
|
||||
if not os.path.exists(self.MBEDTLS_PATH_SRC):
|
||||
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
|
||||
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||
|
||||
cc.n('build mbedtls...', end='')
|
||||
|
@ -406,45 +368,6 @@ class BuilderLinux(BuilderBase):
|
|||
f.writelines(fl)
|
||||
f.close()
|
||||
|
||||
# # fix config.h
|
||||
# mkfile = os.path.join(self.MBEDTLS_PATH_SRC, 'include', 'mbedtls', 'config.h')
|
||||
# f = open(mkfile)
|
||||
# fl = f.readlines()
|
||||
# f.close()
|
||||
#
|
||||
# for i in range(len(fl)):
|
||||
# if fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED\n'
|
||||
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED\n'
|
||||
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED\n'
|
||||
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED\n'
|
||||
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED\n'
|
||||
# elif fl[i].find('#define MBEDTLS_SELF_TEST') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_SELF_TEST\n'
|
||||
# elif fl[i].find('#define MBEDTLS_SSL_RENEGOTIATION') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_SSL_RENEGOTIATION\n'
|
||||
# elif fl[i].find('#define MBEDTLS_ECDH_C') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_ECDH_C\n'
|
||||
# elif fl[i].find('#define MBEDTLS_ECDSA_C') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_ECDSA_C\n'
|
||||
# elif fl[i].find('#define MBEDTLS_ECP_C') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_ECP_C\n'
|
||||
# elif fl[i].find('#define MBEDTLS_NET_C') >= 0:
|
||||
# fl[i] = '//#define MBEDTLS_NET_C\n'
|
||||
#
|
||||
# elif fl[i].find('#define MBEDTLS_RSA_NO_CRT') >= 0:
|
||||
# fl[i] = '#define MBEDTLS_RSA_NO_CRT\n'
|
||||
# elif fl[i].find('#define MBEDTLS_SSL_PROTO_SSL3') >= 0:
|
||||
# fl[i] = '#define MBEDTLS_SSL_PROTO_SSL3\n'
|
||||
#
|
||||
# f = open(mkfile, 'w')
|
||||
# f.writelines(fl)
|
||||
# f.close()
|
||||
|
||||
# fix source file
|
||||
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'include', 'mbedtls', 'config.h'))
|
||||
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'include', 'mbedtls'), os.path.join(self.MBEDTLS_PATH_SRC, 'include', 'mbedtls'), 'config.h')
|
||||
|
@ -502,13 +425,6 @@ class BuilderLinux(BuilderBase):
|
|||
|
||||
def fix_output(self):
|
||||
pass
|
||||
# remove .so files, otherwise will link to .so but not .a in default.
|
||||
# rm = ['libsqlite3.la', 'libsqlite3.so.0', 'libsqlite3.so', 'libsqlite3.so.0.8.6', 'libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
|
||||
# rm = ['libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
|
||||
# for i in rm:
|
||||
# _path = os.path.join(self.PATH_RELEASE, 'lib', i)
|
||||
# if os.path.exists(_path):
|
||||
# utils.remove(_path)
|
||||
|
||||
|
||||
class BuilderMacOS(BuilderBase):
|
||||
|
@ -522,7 +438,6 @@ class BuilderMacOS(BuilderBase):
|
|||
self.LIBUV_PATH_SRC = os.path.join(self.PATH_TMP, 'libuv-{}'.format(env.ver_libuv))
|
||||
self.MBEDTLS_PATH_SRC = os.path.join(self.PATH_TMP, 'mbedtls-mbedtls-{}'.format(env.ver_mbedtls))
|
||||
self.LIBSSH_PATH_SRC = os.path.join(self.PATH_TMP, 'libssh-{}'.format(env.ver_libssh))
|
||||
# self.SQLITE_PATH_SRC = os.path.join(self.PATH_TMP, 'sqlite-autoconf-{}'.format(env.ver_sqlite))
|
||||
|
||||
self.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp')
|
||||
self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose')
|
||||
|
@ -552,12 +467,9 @@ class BuilderMacOS(BuilderBase):
|
|||
if not super()._build_openssl(file_name):
|
||||
return
|
||||
|
||||
cc.n('prepare openssl source code...')
|
||||
_alt_ver = '_'.join(env.ver_ossl.split('.'))
|
||||
cc.n('prepare openssl source code...', end='')
|
||||
if not os.path.exists(self.OPENSSL_PATH_SRC):
|
||||
# utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
|
||||
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||
# os.rename(os.path.join(PATH_EXTERNAL, 'openssl-OpenSSL_{}'.format(_alt_ver)), self.OPENSSL_PATH_SRC)
|
||||
if not os.path.exists(self.OPENSSL_PATH_SRC):
|
||||
raise RuntimeError('can not prepare openssl source code.')
|
||||
else:
|
||||
|
@ -581,9 +493,7 @@ class BuilderMacOS(BuilderBase):
|
|||
|
||||
def _build_libuv(self, file_name):
|
||||
cc.n('prepare libuv source code...', end='')
|
||||
# return
|
||||
if not os.path.exists(self.LIBUV_PATH_SRC):
|
||||
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
|
||||
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||
|
||||
cc.n('build libuv...', end='')
|
||||
|
@ -605,7 +515,6 @@ class BuilderMacOS(BuilderBase):
|
|||
|
||||
def _build_mbedtls(self, file_name):
|
||||
if not os.path.exists(self.MBEDTLS_PATH_SRC):
|
||||
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
|
||||
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||
|
||||
cc.n('build mbedtls...', end='')
|
||||
|
@ -650,12 +559,11 @@ class BuilderMacOS(BuilderBase):
|
|||
|
||||
def _build_libssh(self, file_name):
|
||||
if not os.path.exists(self.LIBSSH_PATH_SRC):
|
||||
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
|
||||
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||
# os.rename(os.path.join(self.PATH_TMP, 'master'), os.path.join(self.PATH_TMP, 'libssh-{}'.format(LIBSSH_VER)))
|
||||
|
||||
cc.n('build libssh...', end='')
|
||||
if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')) and os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh_threads.a')):
|
||||
# if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')) and os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh_threads.a')):
|
||||
if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')):
|
||||
cc.w('already exists, skip.')
|
||||
return
|
||||
cc.v('')
|
||||
|
@ -747,9 +655,6 @@ def main():
|
|||
builder.build_mbedtls()
|
||||
builder.build_libssh()
|
||||
|
||||
# do not need sqlite any more.
|
||||
# builder.build_sqlite()
|
||||
|
||||
builder.fix_output()
|
||||
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class BuilderMacOS(BuilderBase):
|
|||
|
||||
utils.makedirs(out_path)
|
||||
|
||||
utils.cmake(os.path.join(env.root_path, 'server', 'cmake-build'), ctx.target_path, False)
|
||||
utils.cmake(os.path.join(env.root_path, 'cmake-build'), ctx.target_path, False)
|
||||
# utils.strip(out_file)
|
||||
|
||||
for f in out_files:
|
||||
|
|
|
@ -319,20 +319,7 @@ class Builder:
|
|||
if nsiline.find('\n') != -1:
|
||||
nsiline = nsiline[:-1]
|
||||
|
||||
# if nsiline.find(" FILE_VER") != -1 or nsiline.find(" STR_FILE_VER") != -1:
|
||||
if nsiline.startswith("!define FILE_VER"):
|
||||
# # cc.v('[ver] old ver: %s' % nsiLines[x])
|
||||
# pos1 = nsiline.find('"')
|
||||
# pos2 = nsiline.rfind('"')
|
||||
# _ver = nsiline[pos1 + 1: pos2]
|
||||
|
||||
# nsiSplitList = _ver.split(".")
|
||||
# if (len(nsiSplitList) != 3):
|
||||
# raise RuntimeError('Invalid .nsi file (1).')
|
||||
# if '.'.join(nsiSplitList) == ver:
|
||||
# continue
|
||||
|
||||
# # nsiline = '%s\"%d.%d.%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor, self.revision, self.build)
|
||||
nsiline = '!define FILE_VER \"%s.%s.%s.0\"\n' % (t_ver[0], t_ver[1], t_ver[2])
|
||||
|
||||
nsiLines[x] = ""
|
||||
|
@ -340,20 +327,7 @@ class Builder:
|
|||
# cc.v('[ver] new ver: %s' % nsiLines[x])
|
||||
bOK = True
|
||||
|
||||
# elif nsiline.find(" OUT_VER") != -1 or nsiline.find(" STR_OUT_VER") != -1:
|
||||
elif nsiline.startswith("!define OUT_VER"):
|
||||
# # cc.v('[ver] old ver: %s' % nsiLines[x])
|
||||
# pos1 = nsiline.find('"')
|
||||
# pos2 = nsiline.rfind('"')
|
||||
# _ver = nsiline[pos1 + 1: pos2]
|
||||
|
||||
# nsiSplitList = _ver.split(".")
|
||||
# if (len(nsiSplitList) != 3):
|
||||
# raise RuntimeError('Invalid .nsi file (1).')
|
||||
# if '.'.join(nsiSplitList) == ver:
|
||||
# continue
|
||||
|
||||
# nsiline = '%s\"%d.%d.%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor, self.revision, self.build)
|
||||
nsiline = '!define OUT_VER \"%s.%s.%s\"\n' % (t_ver[0], t_ver[1], t_ver[2])
|
||||
|
||||
nsiLines[x] = ""
|
||||
|
@ -361,18 +335,6 @@ class Builder:
|
|||
# cc.v('[ver] new ver: %s' % nsiLines[x])
|
||||
bOK = True
|
||||
elif nsiline.startswith("!define PRODUCT_VER"):
|
||||
# # cc.v('[ver] old ver: %s' % nsiLines[x])
|
||||
# pos1 = nsiline.find('"')
|
||||
# pos2 = nsiline.rfind('"')
|
||||
# _ver = nsiline[pos1 + 1: pos2]
|
||||
|
||||
# nsiSplitList = _ver.split(".")
|
||||
# if (len(nsiSplitList) != 2):
|
||||
# raise RuntimeError('Invalid .nsi file (2).')
|
||||
# if '.'.join(nsiSplitList) == '%s.%s' % (t_ver[0], t_ver[1]):
|
||||
# continue
|
||||
|
||||
# nsiline = '%s\"%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor)
|
||||
nsiline = '!define PRODUCT_VER \"%s.%s\"\n' % (t_ver[0], t_ver[1])
|
||||
|
||||
nsiLines[x] = ""
|
||||
|
@ -417,24 +379,6 @@ class Builder:
|
|||
if l.find('<key>CFBundleVersion</key>') != -1:
|
||||
is_ver = True
|
||||
continue
|
||||
# pos1 = rcline.find(' FILEVERSION ')
|
||||
# pos2 = rcline.rfind('\\0"')
|
||||
# _ver = rcline[pos1 + 13: pos2].strip()
|
||||
#
|
||||
# rcSplitList = _ver.split(",")
|
||||
# if (len(rcSplitList) < 4):
|
||||
# rcSplitList = _ver.split(".")
|
||||
# if (len(rcSplitList) < 4):
|
||||
# raise RuntimeError('Invalid .rc file.')
|
||||
# if '.'.join(rcSplitList) == ver:
|
||||
# continue
|
||||
#
|
||||
# rcline = '%s%s,%s,%s,%s\n' % (rcline[0:pos1 + 13], t_ver[0], t_ver[1], t_ver[2], t_ver[3])
|
||||
#
|
||||
# rcLines[x] = ""
|
||||
# rcLines[x] = rcline
|
||||
# # cc.v('[ver] new ver: %s' % rcLines[x])
|
||||
# bOK = True
|
||||
|
||||
if is_ver:
|
||||
is_ver = False
|
||||
|
|
|
@ -50,29 +50,41 @@ def _check_download_file(file_name):
|
|||
def download_file(desc, url, target_path, file_name):
|
||||
cc.n('download {} ... '.format(desc), end='')
|
||||
|
||||
local_file_name = os.path.join(target_path, file_name)
|
||||
if os.path.exists(local_file_name):
|
||||
if not _check_download_file(local_file_name):
|
||||
cc.w('already exists but broken, download it again...')
|
||||
else:
|
||||
cc.w('already exists, skip.')
|
||||
return True
|
||||
_temp_file = os.path.join(target_path, '_dl_{}'.format(file_name))
|
||||
_real_file = os.path.join(target_path, file_name)
|
||||
|
||||
if os.path.exists(_temp_file):
|
||||
cc.w('already exists but broken, download it again...')
|
||||
remove(_temp_file)
|
||||
remove(_real_file)
|
||||
|
||||
# if not _check_download_file(local_file_name):
|
||||
# cc.w('already exists but broken, download it again...')
|
||||
# else:
|
||||
# cc.w('already exists, skip.')
|
||||
# return True
|
||||
|
||||
if os.path.exists(_real_file):
|
||||
cc.w('already exists, skip.')
|
||||
return True
|
||||
|
||||
cc.v('')
|
||||
# 因为下载过程会在命令行显示进度,所以不能使用subprocess.Popen()的方式捕获输出,会很难看!
|
||||
if env.is_win:
|
||||
cmd = '""{}" --no-check-certificate {} -O "{}""'.format(env.wget, url, local_file_name)
|
||||
cmd = '""{}" --no-check-certificate {} -O "{}""'.format(env.wget, url, _temp_file)
|
||||
os.system(cmd)
|
||||
elif env.is_linux or env.is_macos:
|
||||
os.system('wget --no-check-certificate {} -O "{}"'.format(url, local_file_name))
|
||||
os.system('wget --no-check-certificate {} -O "{}"'.format(url, _temp_file))
|
||||
else:
|
||||
cc.e('can not download, no download tool.')
|
||||
return False
|
||||
|
||||
if not os.path.exists(local_file_name) or not _check_download_file(local_file_name):
|
||||
if not os.path.exists(_temp_file) or not _check_download_file(_temp_file):
|
||||
cc.e('downloading {} from {} failed.'.format(desc, url))
|
||||
return False
|
||||
|
||||
os.rename(_temp_file, _real_file)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue