def _make_python_zip(self): cc.n('make python.zip...') out_file = os.path.join(self.base_path, 'python.zip') if os.path.exists(out_file): utils.remove(out_file) _tmp_ = os.path.join(self.base_path, '_tmp_') if os.path.exists(_tmp_): cc.v('clear up temp folder...') utils.remove(_tmp_) cc.v('copying Python `Lib` folder...') shutil.copytree(self.py_lib_path, _tmp_) cc.v('remove useless folders and files...') for i in self.py_lib_remove: utils.remove(_tmp_, i) cc.v('compile .py to .pyc...') makepyo.make(_tmp_) cc.v('compress into python.zip...') utils.make_zip(_tmp_, out_file, from_parent=False) utils.ensure_file_exists(out_file) cc.v('remove temp folder...') utils.remove(_tmp_)
def build_installer(self): cc.n('make teleport installer package...') if os.path.exists(self.base_tmp): utils.remove(self.base_tmp) self._build_web(self.base_path, 'windows', self.path_tmp_data) utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('web.ini.in', 'web.ini')) utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('core.ini.in', 'core.ini')) utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), 'tp_ssh_server.key') out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path) bin_path = os.path.join(self.path_tmp_data, 'bin') utils.copy_ex(out_path, bin_path, 'tp_web.exe') utils.copy_ex(out_path, bin_path, 'tp_core.exe') utils.copy_ex(out_path, bin_path, 'tpssh.dll') utils.copy_ex(out_path, bin_path, 'tptelnet.dll') if with_rdp: utils.copy_ex(out_path, bin_path, 'tprdp.dll') utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt')) # copy scripts utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'setup.bat') utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'script') if os.path.exists(self._final_file): utils.remove(self._final_file) utils.make_zip(self.path_tmp, self._final_file)
def build_installer(self): cc.n('make teleport installer package...') if os.path.exists(self.base_tmp): utils.remove(self.base_tmp) self._build_web(self.base_path, 'windows', self.path_tmp_data) utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('web.ini.in', 'web.ini')) utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('core.ini.in', 'core.ini')) utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), 'tp_ssh_server.key') out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path) bin_path = os.path.join(self.path_tmp_data, 'bin') utils.copy_ex(out_path, bin_path, 'tp_web.exe') utils.copy_ex(out_path, bin_path, 'tp_core.exe') utils.copy_ex(out_path, bin_path, 'tpssh.dll') utils.copy_ex(out_path, bin_path, 'tptelnet.dll') if with_rdp: utils.copy_ex(out_path, bin_path, 'tprdp.dll') utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt')) # 复制安装所需的脚本 utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'setup.bat') utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'script') if os.path.exists(self._final_file): utils.remove(self._final_file) utils.make_zip(self.path_tmp, self._final_file)