Check python if system already equipped one

avx_docs
liaogang 8 years ago
parent 5c0178b0f2
commit c24e94c8a4

@ -21,13 +21,14 @@ addons:
packages: packages:
- gcc-4.8 - gcc-4.8
- g++-4.8 - g++-4.8
- wget
- git - git
- build-essential - build-essential
- libatlas-base-dev - libatlas-base-dev
- python - python
- python-pip - python-pip
- python2.7-dev - python2.7-dev
- python-numpy
- python-wheel
- curl - curl
- swig - swig
- graphviz - graphviz
@ -48,8 +49,7 @@ before_install:
fi fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then paddle/scripts/travis/before_install.osx.sh; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then paddle/scripts/travis/before_install.osx.sh; fi
- if [[ "$JOB" == "PRE_COMMIT" ]]; then sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format; fi - if [[ "$JOB" == "PRE_COMMIT" ]]; then sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format; fi
- pip install --upgrade pip - pip install numpy wheel protobuf sphinx recommonmark sphinx_rtd_theme virtualenv pre-commit requests==2.9.2 LinkChecker
- pip install wheel protobuf sphinx recommonmark sphinx_rtd_theme virtualenv pre-commit requests==2.9.2 LinkChecker
script: script:
- paddle/scripts/travis/main.sh - paddle/scripts/travis/main.sh
notifications: notifications:

@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
if(NOT WITH_PYTHON)
add_definitions(-DPADDLE_NO_PYTHON)
endif(NOT WITH_PYTHON)
if(WITH_DSO) if(WITH_DSO)
add_definitions(-DPADDLE_USE_DSO) add_definitions(-DPADDLE_USE_DSO)
endif(WITH_DSO) endif(WITH_DSO)

File diff suppressed because it is too large Load Diff

@ -94,17 +94,19 @@ add_dependencies(python_api_wheel python_swig_sources
paddle_cuda) paddle_cuda)
if(WITH_TESTING) if(WITH_TESTING)
SET(PIP_SOURCES_DIR ${PYTHON_SOURCES_DIR}/pip) IF(NOT PY_PIP_FOUND)
ExternalProject_Add(pip SET(PIP_SOURCES_DIR ${PYTHON_SOURCES_DIR}/pip)
${EXTERNAL_PROJECT_LOG_ARGS} ExternalProject_Add(pip
GIT_REPOSITORY https://github.com/pypa/pip.git ${EXTERNAL_PROJECT_LOG_ARGS}
GIT_TAG 9.0.1 GIT_REPOSITORY https://github.com/pypa/pip.git
PREFIX ${PIP_SOURCES_DIR} GIT_TAG 9.0.1
CONFIGURE_COMMAND "" PREFIX ${PIP_SOURCES_DIR}
BUILD_COMMAND "" CONFIGURE_COMMAND ""
INSTALL_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install BUILD_COMMAND ""
BUILD_IN_SOURCE 1 INSTALL_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install
DEPENDS python setuptools python_api_wheel BUILD_IN_SOURCE 1
) DEPENDS python setuptools python_api_wheel
)
ENDIF()
add_subdirectory(test) add_subdirectory(test)
endif() endif()

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
brew update brew update
brew tap homebrew/science brew tap homebrew/science
brew install openblas md5sha1sum brew install python
sudo pip install --upgrade protobuf
brew install swig openblas md5sha1sum protobuf

@ -1,23 +1,19 @@
#!/bin/bash #!/bin/bash
source ./common.sh source ./common.sh
python -c 'import pip; print(pip.pep425tags.get_supported())'
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
CMAKE_EXTRA="-DWITH_SWIG_PY=OFF"
else
CMAKE_EXTRA="-DWITH_SWIG_PY=ON"
fi
cmake .. -DWITH_GPU=OFF -DWITH_DOC=OFF -DWITH_TESTING=ON -DON_TRAVIS=ON -DON_COVERALLS=ON ${CMAKE_EXTRA}
NPROC=1 NPROC=1
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
export PYTHONPATH=/opt/python/2.7.12/lib/python2.7/site-packages
export PYTHONHOME=/opt/python/2.7.12
export PATH=/opt/python/2.7.12/bin:${PATH}
cmake .. -DON_TRAVIS=ON -DON_COVERALLS=ON -DCOVERALLS_UPLOAD=ON
NRPOC=`nproc` NRPOC=`nproc`
make -j $NPROC make -j $NPROC
make coveralls make coveralls
sudo make install sudo make install
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
export PYTHONPATH=/usr/local/lib/python2.7/site-packages
cmake .. -DON_TRAVIS=ON -DON_COVERALLS=ON -DCOVERALLS_UPLOAD=ON -DWITH_SWIG_PY=ON
NPROC=`sysctl -n hw.ncpu` NPROC=`sysctl -n hw.ncpu`
make -j $NPROC make -j $NPROC
env CTEST_OUTPUT_ON_FAILURE=1 make test ARGS="-j $NPROC" env CTEST_OUTPUT_ON_FAILURE=1 make test ARGS="-j $NPROC"

@ -195,8 +195,10 @@ extern const char enable_virtualenv_py[];
} }
void initPython(int argc, char** argv) { void initPython(int argc, char** argv) {
#ifndef PADDLE_NO_PYTHON #ifndef PADDLE_NO_PYTHON
char PythonHome[] = "@PYTHON_INSTALL_DIR@"; // NOLINT char pyHome[] = "@PYTHON_INSTALL_DIR@"; // NOLINT
Py_SetPythonHome(PythonHome); if (strlen(pyHome)) {
Py_SetPythonHome(pyHome);
}
Py_SetProgramName(argv[0]); Py_SetProgramName(argv[0]);
Py_Initialize(); Py_Initialize();
PySys_SetArgv(argc, argv); PySys_SetArgv(argc, argv);

Loading…
Cancel
Save