Skip to content

Commit

Permalink
Remove hard code in swig_paddle install script
Browse files Browse the repository at this point in the history
ISSUE=4582455



git-svn-id: https://svn.baidu.com/idl/trunk/paddle@1419 1ad973e4-5ce8-4261-8a94-b56d1f490c56
  • Loading branch information
yuyang18 committed Aug 30, 2016
1 parent 990f660 commit 613462e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions paddle/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ py_paddle/paddle.py
HPPL_ERROR_LOG
unittest.list
proto
dist
18 changes: 8 additions & 10 deletions paddle/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions paddle/api/test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ popd > /dev/null

cd $SCRIPTPATH

if [ ! -f ../../*.whl ] ; then # Swig not compiled.
if [ ! -f ../../dist/*.whl ] ; then # Swig not compiled.
exit 0
fi

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"

Expand Down
3 changes: 2 additions & 1 deletion paddle/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@
install_requires = [
'numpy>=1.10.1', # The numpy is required.
'protobuf>=2.4.1' # The paddle protobuf version
])
],
)

0 comments on commit 613462e

Please sign in to comment.