makerelease.sh 865 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. srcdir="$(dirname "$0")"
  3. [ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir"
  4. srcdir="$srcdir" # git repos root
  5. die() { echo "$*"; exit 1; }
  6. # Import the makerelease.lib
  7. # https://bues.ch/cgit/misc.git/plain/makerelease.lib
  8. for path in $(echo "$PATH" | tr ':' ' '); do
  9. [ -f "$MAKERELEASE_LIB" ] && break
  10. MAKERELEASE_LIB="$path/makerelease.lib"
  11. done
  12. [ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."
  13. hook_get_version()
  14. {
  15. local file="$1/libtoprammer/main.py"
  16. local major="$(cat "$file" | grep -e VERSION_MAJOR | head -n1 | cut -d'=' -f2)"
  17. local minor="$(cat "$file" | grep -e VERSION_MINOR | head -n1 | cut -d'=' -f2)"
  18. [ -n "$major" -a -n "$minor" ] ||\
  19. die "Failed to get version"
  20. version="$(printf '%d.%d' "$major" "$minor")"
  21. }
  22. project=toprammer
  23. default_archives=py-sdist-xz
  24. makerelease "$@"