From f8be2fd1c206afa2a2cd549da468b166ea39ec3b Mon Sep 17 00:00:00 2001 From: Apex Lu Date: Sun, 16 Sep 2018 21:52:10 +0800 Subject: [PATCH] temp. not work yet. --- build.sh | 49 +- build.sh.in | 71 +++ build/build-py-static.sh | 195 -------- build/builder/build-external.py | 310 +++++++------ build/builder/build-pysrt.py | 23 +- build/builder/core/context.py | 2 +- build/builder/core/env.py | 21 +- build/builder/core/makepyo.py | 34 +- build/builder/core/ver.py | 6 +- .../Python-3.4.4/Modules/Setup.dist | 417 ------------------ .../Python-3.4.4/Modules/_sqlite/cache.h | 75 ---- .../Modules/_sqlite/prepare_protocol.h | 43 -- external/version.ini | 3 +- server/tp_core/core/tp_core.rc | Bin 5176 -> 5176 bytes server/tp_core/core/ts_ver.h | 12 +- server/tp_web/src/CMakeLists.txt | 7 +- server/tp_web/src/tp_web.rc | Bin 5178 -> 5186 bytes server/tp_web/src/ts_ver.h | 12 +- server/www/teleport/webroot/app/app_ver.py | 4 +- version.in | 6 +- 20 files changed, 352 insertions(+), 938 deletions(-) create mode 100755 build.sh.in delete mode 100755 build/build-py-static.sh delete mode 100644 external/fix-external/Python-3.4.4/Modules/Setup.dist delete mode 100644 external/fix-external/Python-3.4.4/Modules/_sqlite/cache.h delete mode 100644 external/fix-external/Python-3.4.4/Modules/_sqlite/prepare_protocol.h diff --git a/build.sh b/build.sh index 3d80a9f..8a4dde1 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,21 @@ #!/bin/bash +#--------------------------------------------------------------- +# README +# +# pleas copy build.sh.in to build.sh and change the following +# two lines to fit your env. +# +# Recommend to download miniconda from +# https://conda.io/miniconda.html +# and install it, root priviledge is not necessary. +#--------------------------------------------------------------- +PATH_PYTHON_LINUX=/home/apex/miniconda3 +PATH_PYTHON_MACOS=/path/of/your/python/installation + +################################################################ +# DO NOT TOUCH FOLLOWING CODE +################################################################ PATH_ROOT=$(cd "$(dirname "$0")"; pwd) @@ -7,33 +23,41 @@ function on_error() { echo -e "\033[01m\033[31m" echo "==================[ !! ERROR !! ]==================" + echo "" echo -e $1 + echo "" echo "===================================================" echo -e "\033[0m" exit 1 } +function check_python +{ + if [ ! -f "${PYSTATIC}" ]; then + on_error "python not found." + fi +} + function build_linux { - PYEXEC=${PATH_ROOT}/external/linux/release/bin/python3.4 - PYSTATIC=${PATH_ROOT}/external/linux/release/lib/libpython3.4m.a - - if [ ! -f "${PYSTATIC}" ]; then - echo "python static not found, now build it..." - "${PATH_ROOT}/build/build-py-static.sh" - - if [ ! -f "${PYSTATIC}" ]; then - on_error "can not build python static." - fi - fi + PATH_PYTHON=${PATH_PYTHON_LINUX} + PYEXEC=${PATH_PYTHON}/bin/python3.7 + PYSTATIC=${PATH_PYTHON}/lib/libpython3.7m.a + check_python ${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@ } function build_macos { - python3 -B "${PATH_ROOT}/build/build.py" $@ + PATH_PYTHON=${PATH_PYTHON_LINUX} + PYEXEC=${PATH_PYTHON}/bin/python3.7 + PYSTATIC=${PATH_PYTHON}/lib/libpython3.7m.a + + check_python + + ${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@ } SYSTEM=`uname -s` @@ -44,3 +68,4 @@ elif [ $SYSTEM = "Darwin" ] ; then else echo "Unsupported platform." fi + diff --git a/build.sh.in b/build.sh.in new file mode 100755 index 0000000..fed48f8 --- /dev/null +++ b/build.sh.in @@ -0,0 +1,71 @@ +#!/bin/bash + +#--------------------------------------------------------------- +# README +# +# pleas copy build.sh.in to build.sh and change the following +# two lines to fit your env. +# +# Recommend to download miniconda from +# https://conda.io/miniconda.html +# and install it, root priviledge is not necessary. +#--------------------------------------------------------------- +PATH_PYTHON_LINUX=/path/of/your/miniconda/installation +PATH_PYTHON_MACOS=/path/of/your/miniconda/installation + +################################################################ +# DO NOT TOUCH FOLLOWING CODE +################################################################ + +PATH_ROOT=$(cd "$(dirname "$0")"; pwd) + +function on_error() +{ + echo -e "\033[01m\033[31m" + echo "==================[ !! ERROR !! ]==================" + echo "" + echo -e $1 + echo "" + echo "===================================================" + echo -e "\033[0m" + exit 1 +} + +function check_python +{ + if [ ! -f "${PYSTATIC}" ]; then + on_error "python not found." + fi +} + +function build_linux +{ + PATH_PYTHON=${PATH_PYTHON_LINUX} + PYEXEC=${PATH_PYTHON}/bin/python3.7 + PYSTATIC=${PATH_PYTHON}/lib/libpython3.7m.a + + check_python + + ${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@ +} + +function build_macos +{ + PATH_PYTHON=${PATH_PYTHON_LINUX} + PYEXEC=${PATH_PYTHON}/bin/python3.7 + PYSTATIC=${PATH_PYTHON}/lib/libpython3.7m.a + + check_python + + ${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@ +} + +SYSTEM=`uname -s` +if [ $SYSTEM = "Linux" ] ; then + build_linux +elif [ $SYSTEM = "Darwin" ] ; then + build_macos +else + echo "Unsupported platform." +fi + diff --git a/build/build-py-static.sh b/build/build-py-static.sh deleted file mode 100755 index 4edd4bd..0000000 --- a/build/build-py-static.sh +++ /dev/null @@ -1,195 +0,0 @@ -#!/bin/bash - -################################################################ -# Basic settings. -################################################################ -VER_PYTHON="3.4.4" -VER_PYTHON_SHORT="3.4" -VER_OPENSSL="1.0.2h" -VER_SQLITE="3170000" -VER_PSUTIL="4.2.0" -VER_PYTHON_LIB="${VER_PYTHON_SHORT}m" - -################################################################ -# DO NOT TOUCH FOLLOWING CODE -################################################################ - -FILE_PYTHON_STATIC_LIB="libpython${VER_PYTHON_LIB}.a" - -PATH_ROOT=$(cd "$(dirname "$0")"/..; pwd) -PATH_EXT=${PATH_ROOT}/external -PATH_DOWNLOAD=${PATH_EXT}/_download_ -PATH_TMP=${PATH_EXT}/linux/tmp -PATH_FIX=${PATH_EXT}/fix-external -PATH_RELEASE=${PATH_EXT}/linux/release - - -PY_PATH_SRC=${PATH_TMP}/Python-${VER_PYTHON} -#PATH_SRC=${PATH_TMP}/${VER_PYTHON} -#PATH_INST=${PATH_RELEASE}/python -OSSL_PATH_SRC=${PATH_TMP}/openssl-${VER_OPENSSL} - -function on_error() -{ - echo -e "\033[01m\033[31m" - echo "==================[ !! ERROR !! ]==================" - echo -e $1 - echo "===================================================" - echo -e "\033[0m" - exit 1 -} - -function setp_build_git() -{ - # su -s - # yum install zlib-devel expat-devel libcurl-devel - # make prefix=/usr/local - # make prefix=/usr/local install - echo 'skip build git now.' -} - -function dlfile() -{ - echo -n "Downloading $1 ..." - if [ ! -f "$4/$3" ]; then - echo "" - # curl --insecure https://www.python.org/ftp/python/3.4.3/${VER_PYTHON}.tgz -o "${PATH_PYTHON}/${VER_PYTHON}.tgz" - echo wget $2$3 -O "$4/$3" - wget --no-check-certificate $2$3 -O "$4/$3" - - if [ ! -f "$4/$3" ]; then - on_error "Can not download $1: $3" - fi - else - echo " already exists, skip." - fi -} - -function step_download_files() -{ - echo "download necessary source tarball ..." - - if [ ! -d "${PATH_DOWNLOAD}" ]; then - mkdir -p "${PATH_DOWNLOAD}" - if [ ! -d "${PATH_DOWNLOAD}" ]; then - on_error "Can not create folder for download files." - fi - fi - - dlfile "python source tarball" "https://www.python.org/ftp/python/${VER_PYTHON}/" "Python-${VER_PYTHON}.tgz" ${PATH_DOWNLOAD} - dlfile "openssl source tarball" "https://www.openssl.org/source/" "openssl-${VER_OPENSSL}.tar.gz" ${PATH_DOWNLOAD} - dlfile "sqlite source tarball" "http://sqlite.org/2017/" "sqlite-autoconf-${VER_SQLITE}.tar.gz" ${PATH_DOWNLOAD} - - # dlfile "psutil source tarball" "https://pypi.python.org/packages/source/p/psutil/" "psutil-${VER_PSUTIL}.tar.gz" ${PATH_DOWNLOAD} - # https://pypi.python.org/pypi?:action=display&name=psutil#downloads - - # echo -n "Downloading psutil source tarball ..." - # if [ ! -f "${PATH_DOWNLOAD}/psutil-${VER_PSUTIL}.tar.gz" ]; then - # echo "" - # echo "Because pypi.python.org limit, can not auto-download psutil, please visit following url:" - # echo " https://pypi.python.org/pypi?:action=display&name=psutil#downloads" - # echo "and download psutil-${VER_PSUTIL}.tar.gz and put it into folder:" - # echo " ${PATH_DOWNLOAD}" - # echo "after download, try again." - # on_error "psutil source tarball not exists." - # else - # echo " already exists, skip." - # fi -} - - -function step_prepare_source() -{ - echo "prepare source ..." - - if [ ! -d "${PATH_TMP}" ]; then - mkdir -p "${PATH_TMP}" - if [ ! -d "${PATH_TMP}" ]; then - on_error "Can not create folder for tmp files." - fi - fi - - if [ ! -d "${PATH_TMP}/Python-${VER_PYTHON}" ]; then - tar -zxvf "${PATH_DOWNLOAD}/Python-${VER_PYTHON}.tgz" -C "${PATH_TMP}" - fi - - if [ ! -d "${PATH_TMP}/openssl-${VER_OPENSSL}" ]; then - tar -zxvf "${PATH_DOWNLOAD}/openssl-${VER_OPENSSL}.tar.gz" -C "${PATH_TMP}" - fi - - - if [ ! -d "${PATH_TMP}/sqlite-autoconf-${VER_SQLITE}" ]; then - tar -zxvf "${PATH_DOWNLOAD}/sqlite-autoconf-${VER_SQLITE}.tar.gz" -C "${PATH_TMP}" - fi - - # if [ ! -d "${PATH_TMP}/psutil-${VER_PSUTIL}" ]; then - # tar -zxvf "${PATH_DOWNLOAD}/psutil-${VER_PSUTIL}.tar.gz" -C "${PATH_TMP}" - # fi - - # cp -r "${PATH_TMP}/psutil-${VER_PSUTIL}/psutil" "${PATH_TMP}/Python-${VER_PYTHON}/Modules/." - cp -r "${PATH_TMP}/sqlite-autoconf-${VER_SQLITE}" "${PATH_TMP}/Python-${VER_PYTHON}/Modules/_sqlite/sqlite3" - cp -r "${PATH_FIX}/Python-${VER_PYTHON}" "${PATH_TMP}" -} - -function step_build_openssl() -{ - echo -n "build openssl static library ..." - - if [ ! -f "${PATH_RELEASE}/lib/libssl.a" ] || [ ! -f "${PATH_RELEASE}/lib/libcrypto.a" ]; then - echo "" - cd "${OSSL_PATH_SRC}" - ./config -fPIC --prefix=${PATH_RELEASE} --openssldir=${PATH_RELEASE}/openssl no-zlib no-shared - make - make install - cd "${PATH_ROOT}" - - if [ ! -f "${PATH_RELEASE}/lib/libssl.a" ] || [ ! -f "${PATH_RELEASE}/lib/libcrypto.a" ]; then - on_error "Build openssl failed." - fi - - else - echo " already exists, skip." - fi -} - - -function step_build_python() -{ - echo -n "build python static library ..." - - if [ ! -f "${PATH_RELEASE}/lib/${FILE_PYTHON_STATIC_LIB}" ]; then - cd "${PY_PATH_SRC}" - cp "${PY_PATH_SRC}/Modules/Setup.dist" "${PY_PATH_SRC}/Modules/Setup" - LDFLAGS=-lrt ./configure --disable-shared --prefix=${PATH_RELEASE} - make - make altinstall - cd "${PATH_ROOT}" - - if [ ! -f "${PATH_RELEASE}/lib/${FILE_PYTHON_STATIC_LIB}" ]; then - on_error "Build python failed." - fi - - else - echo " already exists, skip." - fi -} - -function step_finalize() -{ - # copy psutil *.py for release. - echo "finalize ..." - - if [ ! -d "${PATH_RELEASE}/lib/python${VER_PYTHON_SHORT}/site-packages" ]; then - on_error "something goes wrong." - fi - - - # cp -r "${PATH_FIX}/psutil-${VER_PSUTIL}/psutil" "${PATH_RELEASE}/lib/python${VER_PYTHON_SHORT}/site-packages/psutil" -} - - -step_download_files -step_prepare_source -step_build_openssl -step_build_python -step_finalize diff --git a/build/builder/build-external.py b/build/builder/build-external.py index 8eb1da1..61ba1ae 100644 --- a/build/builder/build-external.py +++ b/build/builder/build-external.py @@ -41,15 +41,15 @@ class BuilderBase: def _build_mongoose(self, file_name): cc.e("this is a pure-virtual function.") - def build_openssl(self): - file_name = 'openssl-{}.zip'.format(env.ver_openssl) - _alt_ver = '_'.join(env.ver_openssl.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 - self._build_openssl(file_name) - - def _build_openssl(self, file_name): - cc.e("this is a pure-virtual function.") + # def build_openssl(self): + # file_name = 'openssl-{}.zip'.format(env.ver_openssl) + # _alt_ver = '_'.join(env.ver_openssl.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 + # self._build_openssl(file_name) + # + # def _build_openssl(self, file_name): + # cc.e("this is a pure-virtual function.") def build_libuv(self): file_name = 'libuv-{}.zip'.format(env.ver_libuv) @@ -78,15 +78,21 @@ class BuilderBase: def _build_libssh(self, file_name): 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 prepare_python(self): + self._prepare_python() - def _build_sqlite(self, file_name): + 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 @@ -96,72 +102,78 @@ class BuilderWin(BuilderBase): super().__init__() def _init_path(self): - self.OPENSSL_PATH_SRC = os.path.join(PATH_EXTERNAL, 'openssl') + # self.OPENSSL_PATH_SRC = os.path.join(PATH_EXTERNAL, 'openssl') self.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp') 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._prepare_python_header() + # self._prepare_python_header() - def _prepare_python_header(self): + def _prepare_python(self): cc.n('prepare python header files ...', end='') - if os.path.exists(os.path.join(PATH_EXTERNAL, 'python', 'include', 'pyctype.h')): + if os.path.exists(os.path.join(PATH_EXTERNAL, 'python', 'include', 'Python.h')): cc.w('already exists, skip.') return cc.v('') - _header_path = None - for p in sys.path: - if os.path.exists(os.path.join(p, 'include', 'pyctype.h')): - _header_path = os.path.join(p, 'include') - if _header_path is None: - cc.e('\ncan not locate python development include path in:') - for p in sys.path: - cc.e(' ', p) - raise RuntimeError() - - utils.copy_ex(_header_path, os.path.join(PATH_EXTERNAL, 'python', 'include')) - - def _build_openssl(self, file_name): - cc.n('build openssl static library from source code... ', end='') - _chk_output = [ - os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'libeay32.lib'), - os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'ssleay32.lib'), - os.path.join(self.OPENSSL_PATH_SRC, 'inc32', 'openssl', 'opensslconf.h'), - ] - - need_build = False - for f in _chk_output: - if not os.path.exists(f): - need_build = True - break - - if not need_build: - cc.w('already exists, skip.') + 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('') - cc.n('prepare openssl source code...') - _alt_ver = '_'.join(env.ver_openssl.split('.')) - if not os.path.exists(self.OPENSSL_PATH_SRC): - utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL) - 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: - cc.w('already exists, skip.') + # _header_path = None + # for p in sys.path: + # if os.path.exists(os.path.join(p, 'include', 'pyctype.h')): + # _header_path = os.path.join(p, 'include') + # if _header_path is None: + # cc.e('\ncan not locate python development include path in:') + # for p in sys.path: + # cc.e(' ', p) + # raise RuntimeError() - os.chdir(self.OPENSSL_PATH_SRC) - os.system('""{}" Configure VC-WIN32"'.format(env.perl)) - os.system(r'ms\do_nasm') - os.system(r'"{}\VC\bin\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path)) + # utils.copy_ex(_header_path, os.path.join(PATH_EXTERNAL, 'python', 'include')) + utils.copy_ex(env.path_py_inc, os.path.join(PATH_EXTERNAL, 'python', 'include')) - for f in _chk_output: - if not os.path.exists(f): - raise RuntimeError('build openssl static library from source code failed.') + # def _build_openssl(self, file_name): + # cc.n('build openssl static library from source code... ', end='') + # _chk_output = [ + # os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'libeay32.lib'), + # os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'ssleay32.lib'), + # os.path.join(self.OPENSSL_PATH_SRC, 'inc32', 'openssl', 'opensslconf.h'), + # ] + # + # need_build = False + # for f in _chk_output: + # if not os.path.exists(f): + # need_build = True + # break + # + # if not need_build: + # cc.w('already exists, skip.') + # return + # cc.v('') + # + # cc.n('prepare openssl source code...') + # _alt_ver = '_'.join(env.ver_openssl.split('.')) + # if not os.path.exists(self.OPENSSL_PATH_SRC): + # utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL) + # 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: + # cc.w('already exists, skip.') + # + # os.chdir(self.OPENSSL_PATH_SRC) + # os.system('""{}" Configure VC-WIN32"'.format(env.perl)) + # os.system(r'ms\do_nasm') + # os.system(r'"{}\VC\bin\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path)) + # + # for f in _chk_output: + # if not os.path.exists(f): + # raise RuntimeError('build openssl static library from source code failed.') def _build_libssh(self, file_name): cc.n('build libssh static library from source code... ', end='') @@ -245,9 +257,9 @@ class BuilderWin(BuilderBase): else: cc.w('already exists, skip.') - def build_sqlite(self): - cc.w('sqlite not need for Windows, skip.') - pass + # def build_sqlite(self): + # cc.w('sqlite not need for Windows, skip.') + # pass def fix_output(self): pass @@ -260,11 +272,11 @@ 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_openssl)) + # self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-{}'.format(env.ver_openssl)) 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.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') @@ -272,6 +284,26 @@ class BuilderLinux(BuilderBase): if not os.path.exists(self.PATH_TMP): utils.makedirs(self.PATH_TMP) + def _prepare_python(self): + cc.n('prepare python header and lib files ...') + + if os.path.exists(os.path.join(self.PATH_RELEASE, 'include', 'python', 'Python.h')): + cc.w(' - header file already exists, skip.') + else: + utils.ensure_file_exists(os.path.join(env.path_py_inc, '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')) + + lib_file = 'libpython{}m.a'.format(env.py_ver_dot) + if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', lib_file)): + cc.w(' - lib file already exists, skip.') + else: + utils.ensure_file_exists(os.path.join(env.path_py_lib, lib_file)) + 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='') if not os.path.exists(self.JSONCPP_PATH_SRC): @@ -290,8 +322,8 @@ class BuilderLinux(BuilderBase): else: cc.w('already exists, skip.') - def _build_openssl(self, file_name): - pass # we do not need build openssl anymore, because first time run build.sh we built Python, it include openssl. + # def _build_openssl(self, file_name): + # pass # we do not need build openssl anymore, because first time run build.sh we built Python, it include openssl. def _build_libuv(self, file_name): if not os.path.exists(self.LIBUV_PATH_SRC): @@ -390,8 +422,8 @@ class BuilderLinux(BuilderBase): # 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') - utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library', 'rsa.c')) - utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library'), os.path.join(self.MBEDTLS_PATH_SRC, 'library'), 'rsa.c') + # utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library', 'rsa.c')) + # utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library'), os.path.join(self.MBEDTLS_PATH_SRC, 'library'), 'rsa.c') old_p = os.getcwd() os.chdir(self.MBEDTLS_PATH_SRC) @@ -443,10 +475,10 @@ class BuilderLinux(BuilderBase): # # os.system('make install') # os.chdir(old_p) - cmake_define = ' -DCMAKE_INSTALL_PREFIX={}' \ - ' -D_OPENSSL_VERSION={}' \ - ' -DOPENSSL_INCLUDE_DIR={}/include' \ - ' -DOPENSSL_LIBRARIES={}/lib' \ + cmake_define = ' -DCMAKE_INSTALL_PREFIX={prefix}' \ + ' -D_OPENSSL_VERSION={ossl_ver}' \ + ' -DOPENSSL_INCLUDE_DIR={ossl_inc}' \ + ' -DOPENSSL_LIBRARIES={ossl_lib}' \ ' -DWITH_SSH1=ON' \ ' -DWITH_SFTP=ON' \ ' -DWITH_SERVER=ON' \ @@ -459,7 +491,7 @@ class BuilderLinux(BuilderBase): ' -DWITH_EXAMPLES=OFF' \ ' -DWITH_BENCHMARKS=OFF' \ ' -DWITH_NACL=OFF' \ - ' ..'.format(self.PATH_RELEASE, env.ver_openssl_number, self.PATH_RELEASE, self.PATH_RELEASE) + ' ..'.format(prefix=self.PATH_RELEASE, ossl_ver=env.ver_ossl_number, ossl_inc=env.path_ossl_inc, ossl_lib=env.path_ossl_lib) try: utils.cmake(build_path, 'Release', False, cmake_define) @@ -474,22 +506,22 @@ class BuilderLinux(BuilderBase): utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a') utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'), os.path.join(self.PATH_RELEASE, 'include'), 'libssh') - def _build_sqlite(self, file_name): - if not os.path.exists(self.SQLITE_PATH_SRC): - os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) - - cc.n('build sqlite static...', end='') - if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libsqlite3.a')): - cc.w('already exists, skip.') - return - cc.v('') - - old_p = os.getcwd() - os.chdir(self.SQLITE_PATH_SRC) - os.system('./configure --prefix={}'.format(self.PATH_RELEASE)) - os.system('make') - os.system('make install') - os.chdir(old_p) + # def _build_sqlite(self, file_name): + # if not os.path.exists(self.SQLITE_PATH_SRC): + # os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) + # + # cc.n('build sqlite static...', end='') + # if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libsqlite3.a')): + # cc.w('already exists, skip.') + # return + # cc.v('') + # + # old_p = os.getcwd() + # os.chdir(self.SQLITE_PATH_SRC) + # os.system('./configure --prefix={}'.format(self.PATH_RELEASE)) + # os.system('make') + # os.system('make install') + # os.chdir(old_p) def fix_output(self): # remove .so files, otherwise will link to .so but not .a in default. @@ -508,11 +540,11 @@ class BuilderMacOS(BuilderBase): 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.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.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') @@ -538,25 +570,25 @@ class BuilderMacOS(BuilderBase): else: cc.w('already exists, skip.') - def _build_openssl(self, file_name): - # we do not need build openssl anymore, because first time run build.sh we built Python, it include openssl. - - if not os.path.exists(self.OPENSSL_PATH_SRC): - os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) - - cc.n('build openssl static...', end='') - if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssl.a')): - cc.w('already exists, skip.') - return - - old_p = os.getcwd() - os.chdir(self.OPENSSL_PATH_SRC) - #os.system('./config --prefix={} --openssldir={}/openssl no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE)) - # os.system('./Configure darwin64-x86_64-cc') - os.system('./Configure darwin64-x86_64-cc --prefix={} --openssldir={}/openssl -fPIC no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE)) - os.system('make') - os.system('make install') - os.chdir(old_p) + # def _build_openssl(self, file_name): + # # we do not need build openssl anymore, because first time run build.sh we built Python, it include openssl. + # + # if not os.path.exists(self.OPENSSL_PATH_SRC): + # os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) + # + # cc.n('build openssl static...', end='') + # if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssl.a')): + # cc.w('already exists, skip.') + # return + # + # old_p = os.getcwd() + # os.chdir(self.OPENSSL_PATH_SRC) + # # os.system('./config --prefix={} --openssldir={}/openssl no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE)) + # # os.system('./Configure darwin64-x86_64-cc') + # os.system('./Configure darwin64-x86_64-cc --prefix={} --openssldir={}/openssl -fPIC no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE)) + # os.system('make') + # os.system('make install') + # os.chdir(old_p) def _build_libuv(self, file_name): cc.n('prepare libuv source code...', end='') @@ -618,8 +650,8 @@ class BuilderMacOS(BuilderBase): # 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') - utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library', 'rsa.c')) - utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library'), os.path.join(self.MBEDTLS_PATH_SRC, 'library'), 'rsa.c') + # utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library', 'rsa.c')) + # utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library'), os.path.join(self.MBEDTLS_PATH_SRC, 'library'), 'rsa.c') old_p = os.getcwd() os.chdir(self.MBEDTLS_PATH_SRC) @@ -671,10 +703,10 @@ class BuilderMacOS(BuilderBase): # # os.system('make install') # os.chdir(old_p) - cmake_define = ' -DCMAKE_INSTALL_PREFIX={}' \ - ' -D_OPENSSL_VERSION={}' \ - ' -DOPENSSL_INCLUDE_DIR={}/include' \ - ' -DOPENSSL_LIBRARIES={}/lib' \ + cmake_define = ' -DCMAKE_INSTALL_PREFIX={prefix}' \ + ' -D_OPENSSL_VERSION={oss_ver}' \ + ' -DOPENSSL_INCLUDE_DIR={ossl_inc}' \ + ' -DOPENSSL_LIBRARIES={ossl_lib}' \ ' -DWITH_GSSAPI=OFF' \ ' -DWITH_ZLIB=OFF' \ ' -DWITH_STATIC_LIB=ON' \ @@ -684,7 +716,7 @@ class BuilderMacOS(BuilderBase): ' -DWITH_EXAMPLES=OFF' \ ' -DWITH_BENCHMARKS=OFF' \ ' -DWITH_NACL=OFF' \ - ''.format(self.PATH_RELEASE, env.ver_openssl_number, self.PATH_RELEASE, self.PATH_RELEASE) + ''.format(prefix=self.PATH_RELEASE, oss_ver=env.ver_ossl_number, ossl_inc=env.path_ossl_inc, ossl_lib=env.path_ossl_lib) try: utils.cmake(build_path, 'Release', False, cmake_define) @@ -699,22 +731,22 @@ class BuilderMacOS(BuilderBase): utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a') utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'), os.path.join(self.PATH_RELEASE, 'include'), 'libssh') - def _build_sqlite(self, file_name): - if not os.path.exists(self.SQLITE_PATH_SRC): - os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) - - cc.n('build sqlite static...', end='') - if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libsqlite3.a')): - cc.w('already exists, skip.') - return - cc.v('') - - old_p = os.getcwd() - os.chdir(self.SQLITE_PATH_SRC) - os.system('./configure --prefix={}'.format(self.PATH_RELEASE)) - os.system('make') - os.system('make install') - os.chdir(old_p) + # def _build_sqlite(self, file_name): + # if not os.path.exists(self.SQLITE_PATH_SRC): + # os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) + # + # cc.n('build sqlite static...', end='') + # if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libsqlite3.a')): + # cc.w('already exists, skip.') + # return + # cc.v('') + # + # old_p = os.getcwd() + # os.chdir(self.SQLITE_PATH_SRC) + # os.system('./configure --prefix={}'.format(self.PATH_RELEASE)) + # os.system('make') + # os.system('make install') + # os.chdir(old_p) def fix_output(self): # remove .so files, otherwise will link to .so but not .a in default. @@ -761,9 +793,11 @@ def main(): if builder is None: builder = gen_builder(ctx.host_os) + builder.prepare_python() + builder.build_jsoncpp() builder.build_mongoose() - builder.build_openssl() + # builder.build_openssl() builder.build_libuv() builder.build_mbedtls() builder.build_libssh() diff --git a/build/builder/build-pysrt.py b/build/builder/build-pysrt.py index 34a0df0..8051f5d 100644 --- a/build/builder/build-pysrt.py +++ b/build/builder/build-pysrt.py @@ -2,7 +2,6 @@ import shutil import struct - import sys from core import colorconsole as cc @@ -11,7 +10,6 @@ from core import utils from core.context import * from core.env import env - ctx = BuildContext() MODULES_WIN = ['_bz2', '_ctypes', '_hashlib', '_lzma', '_overlapped', '_socket', '_sqlite3', '_ssl', 'select', 'sqlite3', 'unicodedata'] @@ -19,7 +17,7 @@ PY_LIB_REMOVE_WIN = ['ctypes/test', 'curses', 'dbm', 'distutils', 'email/test', 'lib-dynload', 'pydoc_data', 'site-packages', 'sqlite3/test', 'test', 'tkinter', 'turtledemo', 'unittest', 'venv', 'wsgiref', 'dis.py', 'doctest.py', 'pdb.py', 'py_compile.py', 'pydoc.py', 'this.py', 'wave.py', 'webbrowser.py', 'zipapp.py'] -PY_LIB_REMOVE_LINUX = ['ctypes/test', 'curses', 'config-3.4m-x86_64-linux-gnu', 'dbm', 'distutils', 'ensurepip', 'idlelib', 'lib2to3', +PY_LIB_REMOVE_LINUX = ['ctypes/test', 'curses', 'config-3.7m-x86_64-linux-gnu', 'dbm', 'distutils', 'ensurepip', 'idlelib', 'lib2to3', 'lib-dynload', 'pydoc_data', 'site-packages', 'sqlite3/test', 'test', 'tkinter', 'turtledemo', 'unittest', 'venv', 'wsgiref', 'dis.py', 'doctest.py', 'pdb.py', 'py_compile.py', 'pydoc_data', 'pydoc.py', 'this.py', 'wave.py', 'webbrowser.py', 'zipapp.py'] @@ -110,7 +108,7 @@ class PYSBase: return '' -class PYSBaseWin(PYSBase): +class PYSWin(PYSBase): def __init__(self): super().__init__() self.modules = MODULES_WIN @@ -164,6 +162,8 @@ class PYSBaseWin(PYSBase): if ctx.py_ver == '34': msvcrdll = 'msvcr100.dll' + elif ctx.py_ver == '37': + msvcrdll = 'msvcr140.dll' else: raise RuntimeError('unknown msvc runtime for this python version.') shutil.copy(os.path.join(_win_system_path, msvcrdll), os.path.join(self.base_path, msvcrdll)) @@ -182,18 +182,19 @@ class PYSBaseWin(PYSBase): return 'python{}.dll'.format(env.py_ver_str) -class PYSBaseLinux(PYSBase): +class PYSLinux(PYSBase): def __init__(self): super().__init__() - self.PY_STATIC_PATH = os.path.join(os.path.join(env.root_path, 'external', 'linux', 'release')) - if not os.path.exists(self.PY_STATIC_PATH): + self.PATH_PYTHON_ROOT = env.path_miniconda # os.path.abspath(os.path.join(os.path.dirname(sys.executable), '..')) + if not os.path.exists(self.PATH_PYTHON_ROOT): raise RuntimeError('can not locate py-static release folder.') self.py_lib_remove = PY_LIB_REMOVE_LINUX + self.py_lib_remove.append('config-{}m-x86_64-linux-gnu'.format(ctx.py_dot_ver)) def _locate_dll_path(self): - _path = os.path.join(self.PY_STATIC_PATH, 'lib', 'python3.4', 'lib-dynload') + _path = os.path.join(self.PATH_PYTHON_ROOT, 'lib', 'python{}'.format(ctx.py_dot_ver), 'lib-dynload') if os.path.exists(_path): return _path @@ -201,7 +202,7 @@ class PYSBaseLinux(PYSBase): raise RuntimeError() def _locate_lib_path(self): - _path = os.path.join(self.PY_STATIC_PATH, 'lib', 'python3.4') + _path = os.path.join(self.PATH_PYTHON_ROOT, 'lib', 'python{}'.format(ctx.py_dot_ver)) if os.path.exists(os.path.join(_path, 'ctypes', 'wintypes.py')): return _path @@ -229,9 +230,9 @@ def main(): return if ctx.host_os == 'windows': - x = PYSBaseWin() + x = PYSWin() elif ctx.host_os == 'linux': - x = PYSBaseLinux() + x = PYSLinux() else: raise RuntimeError('unsupported platform:', ctx.host_os) diff --git a/build/builder/core/context.py b/build/builder/core/context.py index 1663a16..9237f3f 100644 --- a/build/builder/core/context.py +++ b/build/builder/core/context.py @@ -29,6 +29,7 @@ class BuildContext(object): _py_ver = platform.python_version_tuple() self.py_ver = '%s%s' % (_py_ver[0], _py_ver[1]) + self.py_dot_ver = '%s.%s' % (_py_ver[0], _py_ver[1]) self.bits = BITS_32 self.bits_path = 'x86' @@ -58,7 +59,6 @@ class BuildContext(object): if self.host_os == 'windows': self.host_os_is_win_x64 = 'PROGRAMFILES(X86)' in os.environ - self.make_dist_path() def make_dist_path(self): diff --git a/build/builder/core/env.py b/build/builder/core/env.py index c1765d4..f572a66 100644 --- a/build/builder/core/env.py +++ b/build/builder/core/env.py @@ -31,6 +31,7 @@ class Env(object): self.py_ver = platform.python_version_tuple() self.py_ver_str = '%s%s' % (self.py_ver[0], self.py_ver[1]) + self.py_ver_dot = '%s.%s' % (self.py_ver[0], self.py_ver[1]) self.py_exec = sys.executable self.bits = self.BITS_32 @@ -52,9 +53,19 @@ class Env(object): self.is_win = True self.plat = 'windows' self.is_win_x64 = 'PROGRAMFILES(X86)' in os.environ + self.path_miniconda = os.path.abspath(os.path.dirname(self.py_exec)) + self.path_ossl_inc = os.path.join(self.path_miniconda, 'Library', 'include') + self.path_ossl_lib = os.path.join(self.path_miniconda, 'Library', 'lib') + self.path_py_inc = os.path.join(self.path_miniconda, 'include') + self.path_py_lib = os.path.join(self.path_miniconda, 'libs') elif _os == 'linux': self.is_linux = True self.plat = 'linux' + self.path_miniconda = os.path.abspath(os.path.join(os.path.dirname(self.py_exec), '..')) + self.path_ossl_inc = os.path.join(self.path_miniconda, 'include') + self.path_ossl_lib = os.path.join(self.path_miniconda, 'lib') + self.path_py_inc = os.path.join(self.path_miniconda, 'include', 'python{}m'.format(self.py_ver_dot)) + self.path_py_lib = os.path.join(self.path_miniconda, 'lib') elif _os == 'darwin': self.is_macos = True self.plat = 'macos' @@ -66,6 +77,10 @@ class Env(object): if not self._load_version(): return False + if not os.path.exists(os.path.join(self.path_miniconda, 'conda-meta')): + cc.e('can not find conda, please install miniconda from https://conda.io/miniconda.html and try again.') + return False + return True def _load_config(self, warn_miss_tool): @@ -170,12 +185,12 @@ class Env(object): _tmp = _cfg['external_ver'] try: _v_openssl = _tmp['openssl'].split(',') - self.ver_openssl = _v_openssl[0].strip() - self.ver_openssl_number = _v_openssl[1].strip() + self.ver_ossl = _v_openssl[0].strip() + self.ver_ossl_number = _v_openssl[1].strip() self.ver_libuv = _tmp['libuv'] self.ver_mbedtls = _tmp['mbedtls'] - self.ver_sqlite = _tmp['sqlite'] + # self.ver_sqlite = _tmp['sqlite'] self.ver_libssh = _tmp['libssh'] self.ver_jsoncpp = _tmp['jsoncpp'] self.ver_mongoose = _tmp['mongoose'] diff --git a/build/builder/core/makepyo.py b/build/builder/core/makepyo.py index fffbcdf..35e5966 100644 --- a/build/builder/core/makepyo.py +++ b/build/builder/core/makepyo.py @@ -16,6 +16,7 @@ rm_file_every_level = ['.pyc', '.pyo'] PY_VER = platform.python_version_tuple() cpython_mid_name = 'cpython-{}{}'.format(PY_VER[0], PY_VER[1]) + def make(tmp_path): cc.v('Remove all old .pyc/.pyo files...') clean_folder(tmp_path) @@ -60,15 +61,11 @@ def compile_files(path): compile_files(os.path.join(parent, d)) for filename in file_list: - _, ext = os.path.splitext(filename) + n, ext = os.path.splitext(filename) # fileNameSplitList = filename.split(".") # ext = fileNameSplitList[len(fileNameSplitList) - 1].lower() if ext == '.py': - compile_py(os.path.join(parent, filename)) - - -def compile_py(filename): - py_compile.compile(filename, optimize=2) + py_compile.compile(os.path.join(parent, filename), os.path.join(parent, n)+'.pyo', optimize=2) def fix_pyo(path): @@ -77,19 +74,20 @@ def fix_pyo(path): fix_pyo(os.path.join(parent, d)) for filename in file_list: - fileNameSplitList = filename.split(".") - ext = fileNameSplitList[len(fileNameSplitList) - 1].lower() - if ext == 'py': + # fileNameSplitList = filename.split(".") + # ext = fileNameSplitList[len(fileNameSplitList) - 1].lower() + _, ext = os.path.splitext(filename) + if ext.lower() == '.py': os.remove(os.path.join(parent, filename)) - elif ext == 'pyo': - cpython = fileNameSplitList[len(fileNameSplitList) - 2].lower() - if cpython == cpython_mid_name: - del fileNameSplitList[len(fileNameSplitList) - 2] - else: - continue - t_name = os.path.abspath(os.path.join(parent, '..', '.'.join(fileNameSplitList))) - f_name = os.path.join(parent, filename) - shutil.copy(f_name, t_name) + # elif ext == 'pyo': + # cpython = fileNameSplitList[len(fileNameSplitList) - 2].lower() + # if cpython == cpython_mid_name: + # del fileNameSplitList[len(fileNameSplitList) - 2] + # else: + # continue + # t_name = os.path.abspath(os.path.join(parent, '..', '.'.join(fileNameSplitList))) + # f_name = os.path.join(parent, filename) + # shutil.copy(f_name, t_name) if __name__ == '__main__': diff --git a/build/builder/core/ver.py b/build/builder/core/ver.py index b65d08a..c443d33 100644 --- a/build/builder/core/ver.py +++ b/build/builder/core/ver.py @@ -1,3 +1,3 @@ -# -*- coding: utf8 -*- -VER_TP_SERVER = "3.0.2.9" -VER_TP_ASSIST = "3.0.1.6" +# -*- coding: utf8 -*- +VER_TP_SERVER = "3.1.0.10" +VER_TP_ASSIST = "3.0.1.6" diff --git a/external/fix-external/Python-3.4.4/Modules/Setup.dist b/external/fix-external/Python-3.4.4/Modules/Setup.dist deleted file mode 100644 index eb05856..0000000 --- a/external/fix-external/Python-3.4.4/Modules/Setup.dist +++ /dev/null @@ -1,417 +0,0 @@ -# -*- makefile -*- -# The file Setup is used by the makesetup script to construct the files -# Makefile and config.c, from Makefile.pre and config.c.in, -# respectively. The file Setup itself is initially copied from -# Setup.dist; once it exists it will not be overwritten, so you can edit -# Setup to your heart's content. Note that Makefile.pre is created -# from Makefile.pre.in by the toplevel configure script. - -# (VPATH notes: Setup and Makefile.pre are in the build directory, as -# are Makefile and config.c; the *.in and *.dist files are in the source -# directory.) - -# Each line in this file describes one or more optional modules. -# Modules enabled here will not be compiled by the setup.py script, -# so the file can be used to override setup.py's behavior. - -# Lines have the following structure: -# -# ... [ ...] [ ...] [ ...] -# -# is anything ending in .c (.C, .cc, .c++ are C++ files) -# is anything starting with -I, -D, -U or -C -# is anything ending in .a or beginning with -l or -L -# is anything else but should be a valid Python -# identifier (letters, digits, underscores, beginning with non-digit) -# -# (As the makesetup script changes, it may recognize some other -# arguments as well, e.g. *.so and *.sl as libraries. See the big -# case statement in the makesetup script.) -# -# Lines can also have the form -# -# = -# -# which defines a Make variable definition inserted into Makefile.in -# -# Finally, if a line contains just the word "*shared*" (without the -# quotes but with the stars), then the following modules will not be -# built statically. The build process works like this: -# -# 1. Build all modules that are declared as static in Modules/Setup, -# combine them into libpythonxy.a, combine that into python. -# 2. Build all modules that are listed as shared in Modules/Setup. -# 3. Invoke setup.py. That builds all modules that -# a) are not builtin, and -# b) are not listed in Modules/Setup, and -# c) can be build on the target -# -# Therefore, modules declared to be shared will not be -# included in the config.c file, nor in the list of objects to be -# added to the library archive, and their linker options won't be -# added to the linker options. Rules to create their .o files and -# their shared libraries will still be added to the Makefile, and -# their names will be collected in the Make variable SHAREDMODS. This -# is used to build modules as shared libraries. (They can be -# installed using "make sharedinstall", which is implied by the -# toplevel "make install" target.) (For compatibility, -# *noconfig* has the same effect as *shared*.) -# -# In addition, *static* explicitly declares the following modules to -# be static. Lines containing "*static*" and "*shared*" may thus -# alternate throughout this file. - -# NOTE: As a standard policy, as many modules as can be supported by a -# platform should be present. The distribution comes with all modules -# enabled that are supported by most platforms and don't require you -# to ftp sources from elsewhere. - - -# Some special rules to define PYTHONPATH. -# Edit the definitions below to indicate which options you are using. -# Don't add any whitespace or comments! - -# Directories where library files get installed. -# DESTLIB is for Python modules; MACHDESTLIB for shared libraries. -DESTLIB=$(LIBDEST) -MACHDESTLIB=$(BINLIBDEST) - -# NOTE: all the paths are now relative to the prefix that is computed -# at run time! - -# Standard path -- don't edit. -# No leading colon since this is the first entry. -# Empty since this is now just the runtime prefix. -DESTPATH= - -# Site specific path components -- should begin with : if non-empty -SITEPATH= - -# Standard path components for test modules -TESTPATH= - -# Path components for machine- or system-dependent modules and shared libraries -MACHDEPPATH=:$(PLATDIR) -EXTRAMACHDEPPATH= - -COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH) -PYTHONPATH=$(COREPYTHONPATH) - - -# The modules listed here can't be built as shared libraries for -# various reasons; therefore they are listed here instead of in the -# normal order. - -# This only contains the minimal set of modules required to run the -# setup.py script in the root of the Python source tree. - -posix posixmodule.c # posix (UNIX) system calls -errno errnomodule.c # posix (UNIX) errno values -pwd pwdmodule.c # this is needed to find out the user's home dir - # if $HOME is not set -_sre _sre.c # Fredrik Lundh's new regular expressions -_codecs _codecsmodule.c # access to the builtin codecs and codec registry -_weakref _weakref.c # weak references -_functools _functoolsmodule.c # Tools for working with functions and callable objects -_operator _operator.c # operator.add() and similar goodies -_collections _collectionsmodule.c # Container types -itertools itertoolsmodule.c # Functions creating iterators for efficient looping -atexit atexitmodule.c # Register functions to be run at interpreter-shutdown -_stat _stat.c # stat.h interface - -# access to ISO C locale support -_locale _localemodule.c # -lintl - -# Standard I/O baseline -_io -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c - -# The zipimport module is always imported at startup. Having it as a -# builtin module avoids some bootstrapping problems and reduces overhead. -zipimport zipimport.c - -# faulthandler module -faulthandler faulthandler.c - -# debug tool to trace memory blocks allocated by Python -_tracemalloc _tracemalloc.c hashtable.c - -# The rest of the modules listed in this file are all commented out by -# default. Usually they can be detected and built as dynamically -# loaded modules by the new setup.py script added in Python 2.1. If -# you're on a platform that doesn't support dynamic loading, want to -# compile modules statically into the Python binary, or need to -# specify some odd set of compiler switches, you can uncomment the -# appropriate lines below. - -# ====================================================================== - -# The Python symtable module depends on .h files that setup.py doesn't track -_symtable symtablemodule.c - -# Uncommenting the following line tells makesetup that all following -# modules are to be built as shared libraries (see above for more -# detail; also note that *static* reverses this effect): - -#*shared* -*static* - -# GNU readline. Unlike previous Python incarnations, GNU readline is -# now incorporated in an optional module, configured in the Setup file -# instead of by a configure script switch. You may have to insert a -# -L option pointing to the directory where libreadline.* lives, -# and you may have to change -ltermcap to -ltermlib or perhaps remove -# it, depending on your system -- see the GNU readline instructions. -# It's okay for this to be a shared library, too. - -#readline readline.c -lreadline -ltermcap - - -# Modules that should always be present (non UNIX dependent): - -array arraymodule.c # array objects -cmath cmathmodule.c _math.c # -lm # complex math library functions -math mathmodule.c _math.c # -lm # math library functions, e.g. sin() -_struct _struct.c # binary structure packing/unpacking -time timemodule.c # -lm # time operations and variables -_weakref _weakref.c # basic weak reference support -#_testcapi _testcapimodule.c # Python C API test module -_random _randommodule.c # Random number generator -#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator -_pickle _pickle.c # pickle accelerator -_datetime _datetimemodule.c # datetime accelerator -_bisect _bisectmodule.c # Bisection algorithms -_heapq _heapqmodule.c # Heap queue algorithm - -unicodedata unicodedata.c # static Unicode character database - - -# Modules with some UNIX dependencies -- on by default: -# (If you have a really backward UNIX, select and socket may not be -# supported...) - -fcntl fcntlmodule.c # fcntl(2) and ioctl(2) -spwd spwdmodule.c # spwd(3) -grp grpmodule.c # grp(3) -select selectmodule.c # select(2); not on ancient System V - -# Memory-mapped files (also works on Win32). -mmap mmapmodule.c - -# CSV file helper -_csv _csv.c - -# Socket module helper for socket(2) -_socket socketmodule.c - -# Socket module helper for SSL support; you must comment out the other -# socket line above, and possibly edit the SSL variable: -SSL=$(srcdir)/../../release -_ssl _ssl.c \ - -DUSE_SSL -I$(SSL)/include \ - $(SSL)/lib/libssl.a $(SSL)/lib/libcrypto.a -# -lssl -lcrypto - -# The crypt module is now disabled by default because it breaks builds -# on many systems (where -lcrypt is needed), e.g. Linux (I believe). -# -# First, look at Setup.config; configure may have set this for you. - -#_crypt _cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems - - -# Some more UNIX dependent modules -- off by default, since these -# are not supported by all UNIX systems: - -#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere -termios termios.c # Steen Lumholt's termios module -resource resource.c # Jeremy Hylton's rlimit interface - -_posixsubprocess _posixsubprocess.c # POSIX subprocess module helper - -# Multimedia modules -- off by default. -# These don't work for 64-bit platforms!!! -# #993173 says audioop works on 64-bit platforms, though. -# These represent audio samples or images as strings: - -#audioop audioop.c # Operations on audio samples - - -# Note that the _md5 and _sha modules are normally only built if the -# system does not have the OpenSSL libs containing an optimized version. - -# The _md5 module implements the RSA Data Security, Inc. MD5 -# Message-Digest Algorithm, described in RFC 1321. - -_md5 md5module.c - - -# The _sha module implements the SHA checksum algorithms. -# (NIST's Secure Hash Algorithms.) -_sha1 sha1module.c -_sha256 sha256module.c -_sha512 sha512module.c - - -# The _tkinter module. -# -# The command for _tkinter is long and site specific. Please -# uncomment and/or edit those parts as indicated. If you don't have a -# specific extension (e.g. Tix or BLT), leave the corresponding line -# commented out. (Leave the trailing backslashes in! If you -# experience strange errors, you may want to join all uncommented -# lines and remove the backslashes -- the backslash interpretation is -# done by the shell's "read" command and it may not be implemented on -# every system. - -# *** Always uncomment this (leave the leading underscore in!): -# _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ -# *** Uncomment and edit to reflect where your Tcl/Tk libraries are: -# -L/usr/local/lib \ -# *** Uncomment and edit to reflect where your Tcl/Tk headers are: -# -I/usr/local/include \ -# *** Uncomment and edit to reflect where your X11 header files are: -# -I/usr/X11R6/include \ -# *** Or uncomment this for Solaris: -# -I/usr/openwin/include \ -# *** Uncomment and edit for Tix extension only: -# -DWITH_TIX -ltix8.1.8.2 \ -# *** Uncomment and edit for BLT extension only: -# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ -# *** Uncomment and edit for PIL (TkImaging) extension only: -# (See http://www.pythonware.com/products/pil/ for more info) -# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ -# *** Uncomment and edit for TOGL extension only: -# -DWITH_TOGL togl.c \ -# *** Uncomment and edit to reflect your Tcl/Tk versions: -# -ltk8.2 -ltcl8.2 \ -# *** Uncomment and edit to reflect where your X11 libraries are: -# -L/usr/X11R6/lib \ -# *** Or uncomment this for Solaris: -# -L/usr/openwin/lib \ -# *** Uncomment these for TOGL extension only: -# -lGL -lGLU -lXext -lXmu \ -# *** Uncomment for AIX: -# -lld \ -# *** Always uncomment this; X11 libraries to link with: -# -lX11 - -# Lance Ellinghaus's syslog module -syslog syslogmodule.c # syslog daemon interface - - -# Curses support, requiring the System V version of curses, often -# provided by the ncurses library. e.g. on Linux, link with -lncurses -# instead of -lcurses). -# -# First, look at Setup.config; configure may have set this for you. - -#_curses _cursesmodule.c -lcurses -ltermcap -# Wrapper for the panel library that's part of ncurses and SYSV curses. -#_curses_panel _curses_panel.c -lpanel -lncurses - - -# Modules that provide persistent dictionary-like semantics. You will -# probably want to arrange for at least one of them to be available on -# your machine, though none are defined by default because of library -# dependencies. The Python module dbm/__init__.py provides an -# implementation independent wrapper for these; dbm/dumb.py provides -# similar functionality (but slower of course) implemented in Python. - -# The standard Unix dbm module has been moved to Setup.config so that -# it will be compiled as a shared library by default. Compiling it as -# a built-in module causes conflicts with the pybsddb3 module since it -# creates a static dependency on an out-of-date version of db.so. -# -# First, look at Setup.config; configure may have set this for you. - -#_dbm _dbmmodule.c # dbm(3) may require -lndbm or similar - -# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: -# -# First, look at Setup.config; configure may have set this for you. - -#_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm - - -# Helper module for various ascii-encoders -binascii binascii.c - -# Fred Drake's interface to the Python parser -#parser parsermodule.c - - -# Lee Busby's SIGFPE modules. -# The library to link fpectl with is platform specific. -# Choose *one* of the options below for fpectl: - -# For SGI IRIX (tested on 5.3): -#fpectl fpectlmodule.c -lfpe - -# For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): -# (Without the compiler you don't have -lsunmath.) -#fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm - -# For other systems: see instructions in fpectlmodule.c. -#fpectl fpectlmodule.c ... - -# Test module for fpectl. No extra libraries needed. -#fpetest fpetestmodule.c - -# Andrew Kuchling's zlib module. -# This require zlib 1.1.3 (or later). -# See http://www.gzip.org/zlib/ -#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz - -# Interface to the Expat XML parser -# -# Expat was written by James Clark and is now maintained by a group of -# developers on SourceForge; see www.libexpat.org for more -# information. The pyexpat module was written by Paul Prescod after a -# prototype by Jack Jansen. Source of Expat 1.95.2 is included in -# Modules/expat/. Usage of a system shared libexpat.so/expat.dll is -# not advised. -# -# More information on Expat can be found at www.libexpat.org. -# -#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI - -# Hye-Shik Chang's CJKCodecs - -# multibytecodec is required for all the other CJK codec modules -_multibytecodec cjkcodecs/multibytecodec.c - -_codecs_cn cjkcodecs/_codecs_cn.c -_codecs_hk cjkcodecs/_codecs_hk.c -_codecs_iso2022 cjkcodecs/_codecs_iso2022.c -_codecs_jp cjkcodecs/_codecs_jp.c -_codecs_kr cjkcodecs/_codecs_kr.c -_codecs_tw cjkcodecs/_codecs_tw.c - -# Example -- included for reference only: -# xx xxmodule.c - -# Another example -- the 'xxsubtype' module shows C-level subtyping in action -#xxsubtype xxsubtype.c - - -######################################################################## -# add extra-module by apex. -######################################################################## - -zlib zlibmodule.c -I$(srcdir)/Modules/zlib \ - zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/zutil.c \ - zlib/compress.c zlib/uncompr.c zlib/gzclose.c zlib/gzlib.c zlib/gzread.c zlib/gzwrite.c - -#_psutil_linux psutil/_psutil_linux.c -#_psutil_posix psutil/_psutil_posix.c - -_json _json.c - -_sqlite3 -I$(srcdir)/Modules/_sqlite/sqlite3 -I$(srcdir)/Modules/_sqlite \ - $(srcdir)/Modules/_sqlite/sqlite3/sqlite3.c \ - _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c \ - _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c - -# EXTRA_CFLAGS=-DMODULE_NAME='"sqlite3"' -DPSUTIL_VERSION=420 -#EXTRA_CFLAGS=-DPSUTIL_VERSION=420 - diff --git a/external/fix-external/Python-3.4.4/Modules/_sqlite/cache.h b/external/fix-external/Python-3.4.4/Modules/_sqlite/cache.h deleted file mode 100644 index 9d9a95b..0000000 --- a/external/fix-external/Python-3.4.4/Modules/_sqlite/cache.h +++ /dev/null @@ -1,75 +0,0 @@ -/* cache.h - definitions for the LRU cache - * - * Copyright (C) 2004-2010 Gerhard Häring - * - * This file is part of pysqlite. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ - -#ifndef PYSQLITE_CACHE_H -#define PYSQLITE_CACHE_H -#include "Python.h" - -#define MODULE_NAME "sqlite3" - -/* The LRU cache is implemented as a combination of a doubly-linked with a - * dictionary. The list items are of type 'Node' and the dictionary has the - * nodes as values. */ - -typedef struct _pysqlite_Node -{ - PyObject_HEAD - PyObject* key; - PyObject* data; - long count; - struct _pysqlite_Node* prev; - struct _pysqlite_Node* next; -} pysqlite_Node; - -typedef struct -{ - PyObject_HEAD - int size; - - /* a dictionary mapping keys to Node entries */ - PyObject* mapping; - - /* the factory callable */ - PyObject* factory; - - pysqlite_Node* first; - pysqlite_Node* last; - - /* if set, decrement the factory function when the Cache is deallocated. - * this is almost always desirable, but not in the pysqlite context */ - int decref_factory; -} pysqlite_Cache; - -extern PyTypeObject pysqlite_NodeType; -extern PyTypeObject pysqlite_CacheType; - -int pysqlite_node_init(pysqlite_Node* self, PyObject* args, PyObject* kwargs); -void pysqlite_node_dealloc(pysqlite_Node* self); - -int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs); -void pysqlite_cache_dealloc(pysqlite_Cache* self); -PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args); - -int pysqlite_cache_setup_types(void); - -#endif diff --git a/external/fix-external/Python-3.4.4/Modules/_sqlite/prepare_protocol.h b/external/fix-external/Python-3.4.4/Modules/_sqlite/prepare_protocol.h deleted file mode 100644 index 2de505c..0000000 --- a/external/fix-external/Python-3.4.4/Modules/_sqlite/prepare_protocol.h +++ /dev/null @@ -1,43 +0,0 @@ -/* prepare_protocol.h - the protocol for preparing values for SQLite - * - * Copyright (C) 2005-2010 Gerhard Häring - * - * This file is part of pysqlite. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ - -#ifndef PYSQLITE_PREPARE_PROTOCOL_H -#define PYSQLITE_PREPARE_PROTOCOL_H -#include "Python.h" - -#define MODULE_NAME "sqlite3" - -typedef struct -{ - PyObject_HEAD -} pysqlite_PrepareProtocol; - -extern PyTypeObject pysqlite_PrepareProtocolType; - -int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* args, PyObject* kwargs); -void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self); - -int pysqlite_prepare_protocol_setup_types(void); - -#define UNKNOWN (-1) -#endif diff --git a/external/version.ini b/external/version.ini index e6ac946..07e5c26 100644 --- a/external/version.ini +++ b/external/version.ini @@ -1,8 +1,7 @@ [external_ver] -openssl = 1.0.2p,1000208f +openssl = 1.0.2p,1000210f libuv = 1.23.0 mbedtls = 2.12.0 -sqlite = 3170000 libssh = 0.7.5 jsoncpp = 0.10.6 mongoose = 6.12 diff --git a/server/tp_core/core/tp_core.rc b/server/tp_core/core/tp_core.rc index db204840fea94f7aa31af4a8f797408f37cdb6b3..1faeaa425f32fb465d6ff796504a998755d2ce2b 100644 GIT binary patch delta 62 zcmdm?u|s3S0uELq1|0_T$xAu3p)7e$@y%~IjxYhadO(T$ypod*c*Hh8;r_-55!!s8 HH9!SyVz1*@W0+aW0 LOK$$dYsUrv+ZPda delta 74 zcmX@4u}fpa91czc1|0?vHk`biLmk1}e3Roo6OgM1l+*)CzUGyjyn#z>^C#|ij0oY) IuX)4S0IXILeE