PageRenderTime 251ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/silverlining/create-zip.sh

https://bitbucket.org/ianb/silverlining/
Shell | 61 lines | 44 code | 8 blank | 9 comment | 8 complexity | 7cf5820f5fbadb965efb9d5114aae8ab MD5 | raw file
Possible License(s): GPL-2.0
  1. #!/usr/bin/env bash
  2. # This script creates the zip file that is a runnable version of silverlining.
  3. # Usage:
  4. # create-zip.sh
  5. # You may set these environmental variables to control it:
  6. # $BUILD_DIR: place to put the zip file
  7. # $VIRTUALENV: location of a virtualenv.py script
  8. # $VERSION: version to build
  9. # $ZIP_DIR: place to put the zip file
  10. pushd "$(dirname $BASH_SOURCE)/../"
  11. if [ -z "$VERSION" ] ; then
  12. VERSION="$(python setup.py --version)"
  13. fi
  14. if [ -z "$BUILD_DIR" ] ; then
  15. BUILD_DIR="zip-build"
  16. fi
  17. mkdir -p $BUILD_DIR
  18. BUILD="$BUILD_DIR/silverlining-$VERSION"
  19. if [ "$VIRTUALENV" = "" ] ; then
  20. VIRTUALENV="virtualenv"
  21. fi
  22. if [ -e "$BUILD" ] ; then
  23. rm -rf $BUILD
  24. fi
  25. $VIRTUALENV -p python2.6 $BUILD
  26. $BUILD/bin/pip install \
  27. http://bitbucket.org/ianb/cmdutils/get/tip.gz#egg=cmdutils \
  28. https://svn.apache.org/repos/asf/incubator/libcloud/trunk/#egg=libcloud \
  29. simplejson \
  30. -e .
  31. $BUILD/bin/python setup.py install --single-version-externally-managed --record $BUILD_DIR/record.txt
  32. cp silverlining/silverlining-zip-command.py $BUILD/silverlining.py
  33. chmod +x $BUILD/silverlining.py
  34. mv $BUILD/lib/python2.6/site-packages $BUILD/lib.tmp
  35. rm -r $BUILD/lib
  36. mv $BUILD/lib.tmp $BUILD/lib
  37. rm -rf $BUILD/bin $BUILD/include $BUILD/build
  38. rm -r $BUILD/lib/pip-*.egg/ $BUILD/lib/setuptools.pth $BUILD/lib/setuptools-*.egg $BUILD/lib/easy-install.pth
  39. find $BUILD -name '*.pyc' -exec rm {} \;
  40. pushd $BUILD_DIR
  41. if [ -z "$ZIP_DIR" ] ; then
  42. ZIP_DIR="."
  43. fi
  44. F="$ZIP_DIR/silverlining-${VERSION}.zip"
  45. zip -r $F silverlining-${VERSION}
  46. if [ -d ../dist ] ; then
  47. mv $F ../dist
  48. else
  49. if [ -d ../../dist ] ; then
  50. mv $F ../../dist
  51. fi
  52. fi
  53. popd