You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

44 lines
970 B

  1. #!/usr/bin/env bash
  2. PACKAGE="wstools-py3"
  3. set -o nounset
  4. set -o errexit
  5. #set -x
  6. if [ -n "$(git status --porcelain)" ]; then
  7. echo "There are uncomitted changes, please make sure all changes are comitted" >&2
  8. exit 1
  9. fi
  10. if ! [ -f "setup.py" ]; then
  11. echo "setver.sh must be run in the directory where setup.py is" >&2
  12. exit 1
  13. fi
  14. VER="${1:?You must pass a version of the format 0.0.0 as the only argument}"
  15. if git tag | grep -q "${VER}"; then
  16. echo "Git tag for version ${VER} already exists." >&2
  17. exit 1
  18. fi
  19. echo "Setting version to $VER"
  20. ## Update the setup.py
  21. #sed -i "s;^package_version.*=.*;package_version = '${VER}';" setup.py
  22. # Update the package version
  23. sed -i "s;.*version.*;__version__ = '${VER}';" wstools/version.py
  24. # Upload to pypi
  25. python setup.py sdist upload
  26. # Reset the commit, we don't want versions in the commit
  27. git commit -a -m "Updated to version ${VER}"
  28. git tag ${VER}
  29. git push
  30. git push --tags
  31. echo "Package deployed"