/src/pyechonest/mkrelease.sh

http://echo-nest-remix.googlecode.com/ · Shell · 68 lines · 43 code · 13 blank · 12 comment · 9 complexity · 8945a5f578508382a4c841e0ad4127dd MD5 · raw file

  1. #!/bin/bash
  2. # ==============================================
  3. # = This script will make a pyechonest release =
  4. # ==============================================
  5. args=`getopt to: $*`
  6. function usage() {
  7. echo "$0 -o <build result> [-t <temp work dir>]"
  8. }
  9. if [ $? != 0 ]; then
  10. usage
  11. exit 2
  12. fi
  13. EXPORT_LOCATION=""
  14. TEMP_LOCATION="/tmp/pyechonest"
  15. set -- $args
  16. for i
  17. do
  18. case "$i" in
  19. -o)
  20. EXPORT_LOCATION=$2; shift;
  21. shift;;
  22. -t)
  23. TEMP_LOCATION=$2; shift;
  24. shift;;
  25. --)
  26. shift; break;;
  27. esac
  28. done
  29. if [ -z "${EXPORT_LOCATION}" ]; then
  30. usage
  31. exit 2
  32. fi
  33. # check that sphinx is installed, we need it to make the docs!
  34. type -P sphinx-build &>/dev/null || { echo "Please install sphinx (easy_install -U sphinx)" >&2; exit 1; }
  35. # export a clean copy to export location
  36. svn export . "$TEMP_LOCATION"
  37. # remove this script, as well as our test files or .pyc files
  38. rm -rf "$TEMP_LOCATION"/mkrelease.sh
  39. rm -rf "$TEMP_LOCATION"/test.py
  40. rm -rf "$TEMP_LOCATION"/test
  41. rm -rf "$TEMP_LOCATION"/tmp
  42. # remake the docs
  43. cd "$TEMP_LOCATION" && \
  44. python "$TEMP_LOCATION"/setup.py build_sphinx
  45. # remove pyc files
  46. find "$TEMP_LOCATION" -name "*.pyc" | xargs rm -rf
  47. # make zip and copy
  48. cd "$TEMP_LOCATION" && \
  49. zip -r "$EXPORT_LOCATION"/pyechonest.zip .
  50. # make egg and copy
  51. cd "$TEMP_LOCATION" && \
  52. python "$TEMP_LOCATION"/setup.py bdist_egg && \
  53. cp dist/*.egg "$EXPORT_LOCATION"
  54. # remove temp dir
  55. rm -rf "$TEMP_LOCATION"