diff --git a/.travis.yml b/.travis.yml index 840dd228..89d73a45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,6 @@ services: before_script: - psql -d postgresql://postgres:${VNPY_TEST_POSTGRESQL_PASSWORD}@localhost -c "create database vnpy;" - mysql -u root --password=${VNPY_TEST_MYSQL_PASSWORD} -e 'CREATE DATABASE vnpy;' - - alias make="make -j2" script: - pip install psycopg2 mongoengine pymysql # we should support all database in test environment @@ -43,6 +42,7 @@ matrix: packages: - g++-8 before_install: + - alias make="make -j2" - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90 - sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 90 - sudo update-alternatives --install /usr/bin/gcc cc /usr/bin/gcc-8 90 @@ -51,7 +51,7 @@ matrix: - python -m pip install --upgrade pip wheel setuptools # Linux install script - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - - bash ./install.sh + - NPY_NUM_BUILD_JOBS=2 bash ./install.sh - name: "sdist install under Ubuntu: gcc-7" addons: @@ -61,6 +61,7 @@ matrix: packages: - g++-7 before_install: + - alias make="make -j2" - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 - sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-7 90 - sudo update-alternatives --install /usr/bin/gcc cc /usr/bin/gcc-7 90 @@ -78,7 +79,7 @@ matrix: - pip install numpy - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - python setup.py sdist - - pip install dist/`ls dist` + - NPY_NUM_BUILD_JOBS=2 pip install dist/`ls dist` - name: "pip install under osx" os: osx diff --git a/setup.py b/setup.py index 28250618..4540f70e 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,23 @@ import sys from setuptools import Extension, find_packages, setup + +def hook_compiler(): + """ + if numpy is installed, use compiler from that instead of setuptools, + which run faster in multi-core env + """ + try: + from numpy.distutils.ccompiler import CCompiler_compile + import distutils.ccompiler + + distutils.ccompiler.CCompiler.compile = CCompiler_compile + except ImportError: + pass + + +hook_compiler() + with open("vnpy/__init__.py", "rb") as f: version_line = re.search( r"__version__\s+=\s+(.*)", f.read().decode("utf-8")