def _make_base(self): if os.path.exists(self.base_path): cc.v('an exists version found, clean up...', self.base_path) utils.remove(self.base_path) cc.v('make pysbase folder...') utils.makedirs(self.base_path) cc.v('copy python core dll...') _exec_path = os.path.dirname(env.py_exec) # _win_system_path = os.path.join(os.getenv('SystemRoot'), 'system32') # if ctx.bits == BITS_32 and ctx.host_os_is_win_x64: # _win_system_path = os.path.join(os.getenv('SystemRoot'), 'SysWOW64') if not os.path.exists(_exec_path): raise RuntimeError('can not locate python folder at:', _exec_path) pydll = self._get_py_dll_name() shutil.copy(os.path.join(_exec_path, pydll), os.path.join(self.base_path, pydll)) if ctx.py_ver == '34': msvcrdll = 'msvcr100.dll' elif ctx.py_ver == '37': msvcrdll = 'vcruntime140.dll' else: raise RuntimeError('unknown msvc runtime for this python version.') shutil.copy(os.path.join(_exec_path, msvcrdll), os.path.join(self.base_path, msvcrdll)) super()._copy_modules()
def build_server(self): cc.n('build server app (tp_core/libtpssh/libtelnet/librdp/tp_web)...') out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, 'bin') out_files = list() out_files.append(os.path.join(out_path, 'tp_core')) out_files.append(os.path.join(out_path, 'tp_web')) out_files.append(os.path.join(out_path, 'libtpssh.so')) out_files.append(os.path.join(out_path, 'libtptelnet.so')) if with_rdp: out_files.append(os.path.join(out_path, 'libtprdp.so')) for f in out_files: if os.path.exists(f): utils.remove(f) utils.makedirs(out_path) utils.cmake(os.path.join(env.root_path, 'server', 'cmake-build'), ctx.target_path, False) # utils.strip(out_file) for f in out_files: if os.path.exists(f): utils.ensure_file_exists(f)
def _make_base(self): if os.path.exists(self.base_path): cc.v('an exists version found, clean up...', self.base_path) utils.remove(self.base_path) cc.v('make pysrt folder...') utils.makedirs(self.base_path) cc.n('copy python extension dll...') utils.copy_ex(self.py_dll_path, os.path.join(self.base_path, 'modules'))
def download_sbu(path, overwrite=False): _DOWNLOAD_URLS = [ ('http://www3.cs.stonybrook.edu/~cvl/content/datasets/shadow_db/SBU-shadow.zip'), ] download_dir = os.path.join(path, 'downloads') makedirs(download_dir) for url in _DOWNLOAD_URLS: filename = download(url, path=path, overwrite=overwrite) # extract with zipfile.ZipFile(filename, "r") as zf: zf.extractall(path=path) print("Extracted", filename)
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.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.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp') self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose') if not os.path.exists(self.PATH_TMP): utils.makedirs(self.PATH_TMP)
def _copy_modules(self): cc.n('copy python extension dll...') utils.makedirs(self.modules_path) ext = utils.extension_suffixes() cc.v('extension ext:', ext) for m in self.modules: for n in ext: s = os.path.join(self.py_dll_path, m) + n if os.path.exists(s): cc.v('copy %s' % s) cc.v(' -> %s' % os.path.join(self.modules_path, m) + n) shutil.copy(s, os.path.join(self.modules_path, m) + n)
def build_installer(self): cc.i('build assist package for website...') name = 'teleport-assist-{}'.format(VER_TELEPORT_ASSIST) out_path = os.path.join(env.root_path, 'out', 'installer') utils.makedirs(out_path) out_file = os.path.join(out_path, '{}.exe'.format(name)) utils.remove(out_file) self._build_installer() utils.ensure_file_exists(out_file)
def build_installer(self): cc.i('build assist installer...') name = 'teleport-assist-{}-{}'.format(ctx.dist, VER_TP_ASSIST) out_path = os.path.join(env.root_path, 'out', 'installer') utils.makedirs(out_path) out_file = os.path.join(out_path, '{}.exe'.format(name)) utils.remove(out_file) self._build_installer() utils.ensure_file_exists(out_file)
def download_voc(path, overwrite=False): _DOWNLOAD_URLS = [ ('http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar', '34ed68851bce2a36e2a223fa52c661d592c66b3c'), ('http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar', '41a8d6e12baa5ab18ee7f8f8029b9e11805b4ef1'), ('http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar', '4e443f8a2eca6b1dac8a6c57641b67dd40621a49')] makedirs(path) for url, checksum in _DOWNLOAD_URLS: filename = download(url, path=path, overwrite=overwrite, sha1_hash=checksum) # extract with tarfile.open(filename) as tar: tar.extractall(path=path)
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.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.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp') self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose') if not os.path.exists(self.PATH_TMP): utils.makedirs(self.PATH_TMP)
def download_city(path, overwrite=False): _CITY_DOWNLOAD_URLS = [('gtFine_trainvaltest.zip', '99f532cb1af174f5fcc4c5bc8feea8c66246ddbc'), ('leftImg8bit_trainvaltest.zip', '2c0b77ce9933cc635adda307fbba5566f5d9d404')] download_dir = os.path.join(path, 'downloads') makedirs(download_dir) for filename, checksum in _CITY_DOWNLOAD_URLS: if not check_sha1(filename, checksum): raise UserWarning('File {} is downloaded but the content hash does not match. ' \ 'The repo may be outdated or download may be incomplete. ' \ 'If the "repo_url" is overridden, consider switching to ' \ 'the default repo.'.format(filename)) # extract with zipfile.ZipFile(filename, "r") as zip_ref: zip_ref.extractall(path=path) print("Extracted", filename)
def _init_path(self): self.PATH_TMP = os.path.join(PATH_EXTERNAL, 'macos', 'tmp') self.PATH_RELEASE = os.path.join(PATH_EXTERNAL, 'macos', 'release') # self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-OpenSSL_{}'.format(env.ver_openssl.replace('.', '_'))) 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') if not os.path.exists(self.PATH_TMP): utils.makedirs(self.PATH_TMP)
def download_ade(path, overwrite=False): _AUG_DOWNLOAD_URLS = [ ('http://data.csail.mit.edu/places/ADEchallenge/ADEChallengeData2016.zip', '219e1696abb36c8ba3a3afe7fb2f4b4606a897c7'), ('http://data.csail.mit.edu/places/ADEchallenge/release_test.zip', 'e05747892219d10e9243933371a497e905a4860c'), ] download_dir = os.path.join(path, 'downloads') makedirs(download_dir) for url, checksum in _AUG_DOWNLOAD_URLS: filename = download(url, path=download_dir, overwrite=overwrite, sha1_hash=checksum) # extract with zipfile.ZipFile(filename, "r") as zip_ref: zip_ref.extractall(path=path)
def download_aug(path, overwrite=False): _AUG_DOWNLOAD_URLS = [ ('http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/semantic_contours/benchmark.tgz', '7129e0a480c2d6afb02b517bb18ac54283bfaa35')] makedirs(path) for url, checksum in _AUG_DOWNLOAD_URLS: filename = download(url, path=path, overwrite=overwrite, sha1_hash=checksum) # extract with tarfile.open(filename) as tar: tar.extractall(path=path) shutil.move(os.path.join(path, 'benchmark_RELEASE'), os.path.join(path, 'VOCaug')) filenames = ['VOCaug/dataset/train.txt', 'VOCaug/dataset/val.txt'] # generate trainval.txt with open(os.path.join(path, 'VOCaug/dataset/trainval.txt'), 'w') as outfile: for fname in filenames: fname = os.path.join(path, fname) with open(fname) as infile: for line in infile: outfile.write(line)
def _make_base(self): if os.path.exists(self.base_path): cc.v('an exists version found, clean up...', self.base_path) utils.remove(self.base_path) cc.v('make pysrt folder...') utils.makedirs(self.base_path) cc.n('copy python extension dll...') utils.copy_ex(self.py_dll_path, self.modules_path) cc.v('remove useless modules...') for i in PY_MODULE_REMOVE_LINUX: utils.remove(self.modules_path, '{}.cpython-{}m-x86_64-linux-gnu.so'.format(i, ctx.py_ver)) ext = utils.extension_suffixes() files = os.listdir(self.modules_path) for i in files: for n in ext: if i.find('_failed{}'.format(n)) != -1: utils.remove(self.modules_path, i)
def download_coco(path, overwrite=False): _DOWNLOAD_URLS = [ ('http://images.cocodataset.org/zips/train2017.zip', '10ad623668ab00c62c096f0ed636d6aff41faca5'), ('http://images.cocodataset.org/annotations/annotations_trainval2017.zip', '8551ee4bb5860311e79dace7e79cb91e432e78b3'), ('http://images.cocodataset.org/zips/val2017.zip', '4950dc9d00dbe1c933ee0170f5797584351d2a41'), # ('http://images.cocodataset.org/annotations/stuff_annotations_trainval2017.zip', # '46cdcf715b6b4f67e980b529534e79c2edffe084'), # test2017.zip, for those who want to attend the competition. # ('http://images.cocodataset.org/zips/test2017.zip', # '4e443f8a2eca6b1dac8a6c57641b67dd40621a49'), ] makedirs(path) for url, checksum in _DOWNLOAD_URLS: filename = download(url, path=path, overwrite=overwrite, sha1_hash=checksum) # extract with zipfile.ZipFile(filename) as zf: zf.extractall(path=path)
def _make_base(self): if os.path.exists(self.base_path): cc.v('an exists version found, clean up...', self.base_path) utils.remove(self.base_path) cc.v('make pysrt folder...') utils.makedirs(self.base_path) cc.n('copy python extension dll...') utils.copy_ex(self.py_dll_path, self.modules_path) cc.v('remove useless modules...') for i in PY_MODULE_REMOVE_LINUX: utils.remove( self.modules_path, '{}.cpython-{}m-x86_64-linux-gnu.so'.format(i, ctx.py_ver)) ext = utils.extension_suffixes() files = os.listdir(self.modules_path) for i in files: for n in ext: if i.find('_failed{}'.format(n)) != -1: utils.remove(self.modules_path, i)
def _build_installer(): tmp_path = os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist') tmp_app_path = os.path.join(tmp_path, 'apps') tmp_cfg_path = os.path.join(tmp_app_path, 'cfg') if os.path.exists(tmp_app_path): utils.remove(tmp_app_path) utils.makedirs(tmp_app_path) utils.makedirs(tmp_cfg_path) utils.copy_file(os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe') utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, ('tp-assist.windows.json', 'tp-assist.json')) utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'cacert.cer') utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.key') utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.pem') utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'), tmp_app_path, 'site') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty')) utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'putty'), os.path.join(tmp_app_path, 'tools', 'putty'), 'putty.exe') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'winscp')) utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'WinSCP.exe') utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'license.txt') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp')) utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe') utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe') utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll') utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll') utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'msvcr120.dll') utils.copy_file(os.path.join(env.root_path, 'client', 'tools'), os.path.join(tmp_app_path, 'tools'), 'securecrt-telnet.vbs') utils.nsis_build(os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist', 'installer.nsi'))
def build_server(self): cc.n('build server app (tp_core/libtpssh/libtelnet/librdp/tp_web)...') out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, 'bin') out_files = list() out_files.append(os.path.join(out_path, 'tp_core')) out_files.append(os.path.join(out_path, 'tp_web')) out_files.append(os.path.join(out_path, 'libtpssh.so')) out_files.append(os.path.join(out_path, 'libtptelnet.so')) if with_rdp: out_files.append(os.path.join(out_path, 'libtprdp.so')) for f in out_files: if os.path.exists(f): utils.remove(f) utils.makedirs(out_path) utils.cmake(os.path.join(env.root_path, 'cmake-build'), ctx.target_path, False) # utils.strip(out_file) for f in out_files: if os.path.exists(f): utils.ensure_file_exists(f)
def __init__(self): self.out_dir = '' if not os.path.exists(PATH_DOWNLOAD): utils.makedirs(PATH_DOWNLOAD) self._init_path()
def _build_libssh(self, file_name): if not self._download_libssh(file_name): return cc.n('build libssh library from source code... ', end='') if not os.path.exists(self.LIBSSH_PATH_SRC): cc.v('') utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL) os.rename( os.path.join(PATH_EXTERNAL, 'libssh-{}'.format(env.ver_libssh)), self.LIBSSH_PATH_SRC) cc.n('fix libssh source code... ', end='') s_name = 'libssh-{}'.format(env.ver_libssh) utils.ensure_file_exists( os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c')) # # utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c')) # utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c')) utils.copy_file( os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c') # ## utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c') # # utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c') out_file_lib = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.lib') out_file_dll = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.dll') if os.path.exists(out_file_lib) and os.path.exists(out_file_dll): cc.w('already exists, skip.') return cc.v('') build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build') if not os.path.exists(build_path): utils.makedirs(build_path) openssl_path = os.path.join(PATH_EXTERNAL, 'OpenSSL') cmake_define = ' -DOPENSSL_INCLUDE_DIR={path_release}\include' \ ' -DOPENSSL_LIBRARIES={path_release}\lib\VC\static' \ ' -DWITH_SFTP=ON' \ ' -DWITH_SERVER=ON' \ ' -DWITH_GSSAPI=OFF' \ ' -DWITH_ZLIB=OFF' \ ' -DWITH_PCAP=OFF' \ ' -DWITH_STATIC_LIB=ON' \ ' -DUNIT_TESTING=OFF' \ ' -DWITH_EXAMPLES=OFF' \ ' -DWITH_BENCHMARKS=OFF' \ ' -DWITH_NACL=OFF' \ ''.format(path_release=openssl_path) # ' -DCMAKE_INSTALL_PREFIX={path_release}' # ' -DWITH_STATIC_LIB=ON' # ' -DBUILD_SHARED_LIBS=OFF' old_p = os.getcwd() try: os.chdir(build_path) utils.cmake(build_path, 'Release', False, cmake_define=cmake_define) os.chdir(build_path) # utils.sys_exec('make install') except: cc.e('can not make') raise os.chdir(old_p) # cc.w('On Windows, when build libssh, need you use cmake-gui.exe to generate solution file') # cc.w('for Visual Studio 2017. Visit https://docs.tp4a.com for more details.') # cc.w('\nOnce the libssh.sln generated, press Enter to continue or Q to quit...', end='') # try: # x = env.input() # except EOFError: # x = 'q' # if x == 'q': # return cc.i('build libssh...') sln_file = os.path.join(self.LIBSSH_PATH_SRC, 'build', 'libssh.sln') utils.msvc_build(sln_file, 'ssh_shared', ctx.target_path, 'win32', False) utils.ensure_file_exists( os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.lib')) utils.ensure_file_exists( os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.dll')) utils.copy_file( os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path), os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path), 'ssh.lib') utils.copy_file( os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path), os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path), 'ssh.dll') utils.ensure_file_exists(out_file_lib) utils.ensure_file_exists(out_file_dll)
path = os.path.expanduser(args.download_dir) if not os.path.isfile(path) or not os.path.isdir(os.path.join(path, 'VOC2007')) \ or not os.path.isdir(os.path.join(path, 'VOC2012')): if args.no_download: raise ValueError( ('{} is not a valid directory, make sure it is present.' ' Or you should not disable "--no-download" to grab it'. format(path))) else: download_voc(path, overwrite=args.overwrite) shutil.move(os.path.join(path, 'VOCdevkit', 'VOC2007'), os.path.join(path, 'VOC2007')) shutil.move(os.path.join(path, 'VOCdevkit', 'VOC2012'), os.path.join(path, 'VOC2012')) shutil.rmtree(os.path.join(path, 'VOCdevkit')) if not os.path.isdir(os.path.join(path, 'VOCaug')): if args.no_download: raise ValueError( ('{} is not a valid directory, make sure it is present.' ' Or you should not disable "--no-download" to grab it'. format(path))) else: download_aug(path, overwrite=args.overwrite) # make symlink makedirs(os.path.expanduser('~/.torch/datasets')) if os.path.isdir(_TARGET_DIR): os.remove(_TARGET_DIR) os.symlink(path, _TARGET_DIR)
def _build_installer(): tmp_path = os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist') tmp_app_path = os.path.join(tmp_path, 'apps') tmp_cfg_path = os.path.join(tmp_app_path, 'cfg') if os.path.exists(tmp_app_path): utils.remove(tmp_app_path) # if os.path.exists(tmp_cfg_path): # utils.remove(tmp_cfg_path) utils.makedirs(tmp_app_path) utils.makedirs(tmp_cfg_path) utils.copy_file( os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe') # utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'ssh.ini') # utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'scp.ini') # utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'telnet.ini') utils.copy_file( os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'ssh.ini') utils.copy_file( os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'scp.ini') utils.copy_file( os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'telnet.ini') utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist'), tmp_app_path, 'site') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty')) utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'putty'), os.path.join(tmp_app_path, 'tools', 'putty'), 'putty.exe') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'winscp')) utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'WinSCP.exe') utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'license.txt') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp')) utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe') utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe') utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll') utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll') utils.copy_file(os.path.join(env.root_path, 'client', 'tools'), os.path.join(tmp_app_path, 'tools'), 'securecrt-telnet.vbs') utils.nsis_build( os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist', 'installer.nsi'))
( "leftImg8bit_trainvaltest.zip", "2c0b77ce9933cc635adda307fbba5566f5d9d404", ), ] download_dir = os.path.join(path, "downloads") makedirs(download_dir) for filename, checksum in _CITY_DOWNLOAD_URLS: if not check_sha1(filename, checksum): raise UserWarning( "File {} is downloaded but the content hash does not match. " "The repo may be outdated or download may be incomplete. " 'If the "repo_url" is overridden, consider switching to ' "the default repo.".format(filename)) # extract with zipfile.ZipFile(filename, "r") as zip_ref: zip_ref.extractall(path=path) print("Extracted", filename) if __name__ == "__main__": args = parse_args() makedirs(os.path.expanduser("~/.torch/datasets")) if args.download_dir is not None: if os.path.isdir(_TARGET_DIR): os.remove(_TARGET_DIR) # make symlink os.symlink(args.download_dir, _TARGET_DIR) else: download_city(_TARGET_DIR, overwrite=False)
def _build_installer(): tmp_path = os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist') tmp_app_path = os.path.join(tmp_path, 'apps') tmp_cfg_path = os.path.join(tmp_app_path, 'cfg') if os.path.exists(tmp_app_path): utils.remove(tmp_app_path) utils.makedirs(tmp_app_path) utils.makedirs(tmp_cfg_path) utils.copy_file( os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe') utils.copy_file( os.path.join(env.root_path, 'client', 'tp_assist_win', 'runtime'), tmp_app_path, 'vcruntime140.dll') utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, ('tp-assist.windows.json', 'tp-assist.json')) utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'cacert.cer') utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.key') utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.pem') # assist configuration web page utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'), tmp_app_path, 'site') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty')) utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'putty'), os.path.join(tmp_app_path, 'tools', 'putty'), 'putty.exe') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'winscp')) utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'WinSCP.exe') utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'license.txt') utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp')) # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe') # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe') # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll') # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll') # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'msvcr120.dll') utils.copy_file( os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'wfreerdp.exe') utils.copy_file(os.path.join(env.root_path, 'client', 'tools'), os.path.join(tmp_app_path, 'tools'), 'securecrt-telnet.vbs') # tp-player utils.copy_file( os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp-player.exe') # qt-redist qt_redist_path = os.path.join(env.root_path, 'client', 'tools', 'qt-redist') utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Core.dll') utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Gui.dll') utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Network.dll') utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Widgets.dll') utils.copy_ex(os.path.join(qt_redist_path, 'platforms'), os.path.join(tmp_app_path, 'platforms')) utils.copy_ex(os.path.join(qt_redist_path, 'styles'), os.path.join(tmp_app_path, 'styles')) utils.copy_ex(os.path.join(qt_redist_path, 'translations'), os.path.join(tmp_app_path, 'translations')) # zlib suffix = 'd' if ctx.target_path == 'debug' else '' utils.copy_file( os.path.join(env.root_path, 'external', 'zlib', 'build', ctx.target_path), tmp_app_path, 'zlib{}.dll'.format(suffix)) # openssl utils.copy_file( os.path.join(env.root_path, 'external', 'openssl', 'bin'), tmp_app_path, 'libcrypto-1_1.dll') utils.copy_file( os.path.join(env.root_path, 'external', 'openssl', 'bin'), tmp_app_path, 'libssl-1_1.dll') # final build utils.nsis_build( os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist', 'installer.nsi'))