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/_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 db20484..1faeaa4 100644 Binary files a/server/tp_core/core/tp_core.rc and b/server/tp_core/core/tp_core.rc differ diff --git a/server/tp_core/core/ts_ver.h b/server/tp_core/core/ts_ver.h index 09c2cec..be4855b 100644 --- a/server/tp_core/core/ts_ver.h +++ b/server/tp_core/core/ts_ver.h @@ -1,6 +1,6 @@ -#ifndef __TS_SERVER_VER_H__ -#define __TS_SERVER_VER_H__ - -#define TP_SERVER_VER L"3.0.1.6" - -#endif // __TS_SERVER_VER_H__ +#ifndef __TS_SERVER_VER_H__ +#define __TS_SERVER_VER_H__ + +#define TP_SERVER_VER L"3.0.2.7" + +#endif // __TS_SERVER_VER_H__ diff --git a/server/tp_web/src/CMakeLists.txt b/server/tp_web/src/CMakeLists.txt index ec45286..5f4fdcc 100644 --- a/server/tp_web/src/CMakeLists.txt +++ b/server/tp_web/src/CMakeLists.txt @@ -5,7 +5,7 @@ project(tpweb) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${Project_SOURCE_DIR}/../out/server/x64/bin") -set(CMAKE_EXE_LINKER_FLAGS "-export-dynamic") +# set(CMAKE_EXE_LINKER_FLAGS "-export-dynamic") aux_source_directory(. DIR_SRCS) aux_source_directory(../../../common/libex/src DIR_SRCS) @@ -15,10 +15,11 @@ include_directories( ../../../common/libex/include ../../../common/pyshell/include ../../../external/linux/release/include - ../../../external/linux/release/include/python3.4m + ../../../external/linux/release/include/python ) link_directories(../../../external/linux/release/lib) add_executable(tp_web ${DIR_SRCS}) -target_link_libraries(tp_web python3.4m ssl crypto dl pthread rt util) +#target_link_libraries(tp_web python3.7m ssl crypto dl pthread rt util) +target_link_libraries(tp_web python3.7m dl pthread rt util) diff --git a/server/tp_web/src/tp_web.rc b/server/tp_web/src/tp_web.rc index a990256..2e936b2 100644 Binary files a/server/tp_web/src/tp_web.rc and b/server/tp_web/src/tp_web.rc differ diff --git a/server/tp_web/src/ts_ver.h b/server/tp_web/src/ts_ver.h index f8f53d7..d1aa93c 100644 --- a/server/tp_web/src/ts_ver.h +++ b/server/tp_web/src/ts_ver.h @@ -1,6 +1,6 @@ -#ifndef __TS_SERVER_VER_H__ -#define __TS_SERVER_VER_H__ - -#define TP_SERVER_VER L"3.0.0.1" - -#endif // __TS_SERVER_VER_H__ +#ifndef __TS_SERVER_VER_H__ +#define __TS_SERVER_VER_H__ + +#define TP_SERVER_VER L"3.1.0.10" + +#endif // __TS_SERVER_VER_H__ diff --git a/server/www/teleport/webroot/app/app_ver.py b/server/www/teleport/webroot/app/app_ver.py index 2ece8c9..894de5b 100644 --- a/server/www/teleport/webroot/app/app_ver.py +++ b/server/www/teleport/webroot/app/app_ver.py @@ -1,2 +1,2 @@ -# -*- coding: utf8 -*- -TP_SERVER_VER = "3.0.2.9" +# -*- coding: utf8 -*- +TP_SERVER_VER = "3.1.0.10" diff --git a/version.in b/version.in index bf4cc82..dc28807 100644 --- a/version.in +++ b/version.in @@ -13,7 +13,7 @@ Revision : 修订号。主版本号和次版本号都相同但修订号不同 Build : 构建号。构建号用于表明此版本发布之前进行了多少次构建及测试。某些情况下此版本号可以省略。 -TP_SERVER 3.0.2.9 # 整个服务端打包的版本 -TP_TPCORE 3.0.1.6 # 核心服务 tp_core 的版本 -TP_TPWEB 3.0.0.1 # web服务 tp_web 的版本(一般除非升级Python,否则不会变化) +TP_SERVER 3.1.0.10 # 整个服务端打包的版本 +TP_TPCORE 3.0.2.7 # 核心服务 tp_core 的版本 +TP_TPWEB 3.1.0.10 # web服务 tp_web 的版本(一般除非升级Python,否则不会变化) TP_ASSIST 3.0.1.6 # 助手版本