From 613462ec0f8de975730d865706c5031ab33e4642 Mon Sep 17 00:00:00 2001 From: yuyang18 Date: Tue, 30 Aug 2016 05:57:59 +0000 Subject: [PATCH] Remove hard code in swig_paddle install script ISSUE=4582455 git-svn-id: https://svn.baidu.com/idl/trunk/paddle@1419 1ad973e4-5ce8-4261-8a94-b56d1f490c56 --- paddle/.gitignore | 1 + paddle/api/CMakeLists.txt | 18 ++++++++---------- paddle/api/test/run_tests.sh | 4 ++-- paddle/setup.py | 3 ++- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/paddle/.gitignore b/paddle/.gitignore index ae15b7e9751..f46fece211e 100644 --- a/paddle/.gitignore +++ b/paddle/.gitignore @@ -40,3 +40,4 @@ py_paddle/paddle.py HPPL_ERROR_LOG unittest.list proto +dist diff --git a/paddle/api/CMakeLists.txt b/paddle/api/CMakeLists.txt index f364f346d90..fe0da763514 100644 --- a/paddle/api/CMakeLists.txt +++ b/paddle/api/CMakeLists.txt @@ -40,14 +40,11 @@ configure_file( generate_python_api(python_swig_sources) -set(PY_PADDLE_WHEEL_NAME -${PROJ_ROOT}/paddle/py_paddle-0.1.1a10-cp27-none-linux_x86_64.whl) - # TODO(yuyang18) : make wheel name calculated by cmake -add_custom_command(OUTPUT ${PY_PADDLE_WHEEL_NAME} - COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel && - cp dist/*.whl . && - rm -rf dist py_paddle.egg-info build +add_custom_command(OUTPUT ${PROJ_ROOT}/paddle/dist/.timestamp + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel + COMMAND ${CMAKE_COMMAND} -E touch dist/.timestamp + COMMAND rm -rf py_paddle.egg-info build WORKING_DIRECTORY ${PROJ_ROOT}/paddle DEPENDS python_swig_sources paddle_parameter @@ -60,11 +57,12 @@ add_custom_command(OUTPUT ${PY_PADDLE_WHEEL_NAME} paddle_cuda ) -install(FILES ${PY_PADDLE_WHEEL_NAME} - DESTINATION opt/paddle/share/wheels) +install(DIRECTORY ${PROJ_ROOT}/paddle/dist/ + DESTINATION opt/paddle/share/wheels +) add_custom_target(python_api_wheel ALL DEPENDS - ${PY_PADDLE_WHEEL_NAME}) + ${PROJ_ROOT}/paddle/dist/.timestamp) if(WITH_TESTING) add_subdirectory(test) diff --git a/paddle/api/test/run_tests.sh b/paddle/api/test/run_tests.sh index 61a76507d2c..1fc6fd5a8c1 100755 --- a/paddle/api/test/run_tests.sh +++ b/paddle/api/test/run_tests.sh @@ -20,7 +20,7 @@ popd > /dev/null cd $SCRIPTPATH -if [ ! -f ../../*.whl ] ; then # Swig not compiled. +if [ ! -f ../../dist/*.whl ] ; then # Swig not compiled. exit 0 fi @@ -28,7 +28,7 @@ rm .test_env -rf virtualenv .test_env source .test_env/bin/activate -pip --timeout 600 install ../../*.whl +pip --timeout 600 install ../../dist/*.whl test_list="testArguments.py testGradientMachine.py testMatrix.py testVector.py testTrain.py" diff --git a/paddle/setup.py b/paddle/setup.py index 0b98ea5fb8c..69059732b54 100644 --- a/paddle/setup.py +++ b/paddle/setup.py @@ -48,4 +48,5 @@ setup(name="py_paddle", install_requires = [ 'numpy>=1.10.1', # The numpy is required. 'protobuf>=2.4.1' # The paddle protobuf version - ]) + ], +) -- GitLab