chainer 958 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. set -e
  3. root=$(cd $(dirname ${0})/..; pwd)
  4. build=${root}/build
  5. test=${root}/test
  6. third_party=${root}/third_party
  7. tools=${root}/tools
  8. identifier=chainer
  9. virtualenv=${third_party}/virtualenv/${identifier}
  10. bold() {
  11. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  12. }
  13. git_sync() {
  14. mkdir -p "${third_party}"
  15. if [ -d "${third_party}/${1}" ]; then
  16. git -C "${third_party}/${1}" pull --quiet --prune
  17. else
  18. git -C "${third_party}" clone --quiet --recursive ${2}
  19. fi
  20. git -C "${third_party}/${1}" submodule sync --quiet
  21. git -C "${third_party}/${1}" submodule update --quiet --init --recursive
  22. }
  23. clean() {
  24. bold "chainer clean"
  25. rm -rf ${third_party}/${identifier}
  26. }
  27. sync() {
  28. bold "chainer sync"
  29. git_sync chainer https://github.com/chainer/chainer.git
  30. }
  31. while [ "$#" != 0 ]; do
  32. command="$1" && shift
  33. case "${command}" in
  34. "clean") clean;;
  35. "sync") sync;;
  36. esac
  37. done