makerelease.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. srcdir="$(realpath "$0" | xargs dirname)"
  3. srcdir="$srcdir/.."
  4. die() { echo "$*"; exit 1; }
  5. # Import the makerelease.lib
  6. # https://bues.ch/cgit/misc.git/tree/makerelease.lib
  7. for path in $(echo "$PATH" | tr ':' ' '); do
  8. [ -f "$MAKERELEASE_LIB" ] && break
  9. MAKERELEASE_LIB="$path/makerelease.lib"
  10. done
  11. [ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."
  12. hook_get_version()
  13. {
  14. local file="$1/libpwman/version.py"
  15. local maj="$(cat "$file" | grep -Ee '^VERSION_MAJOR\s+=\s+' | head -n1 | awk '{print $3;}')"
  16. local min="$(cat "$file" | grep -Ee '^VERSION_MINOR\s+=\s+' | head -n1 | awk '{print $3;}')"
  17. local ext="$(cat "$file" | grep -Ee '^VERSION_EXTRA\s+=\s+' | head -n1 | awk '{print $3;}' | cut -d'"' -f2)"
  18. version="${maj}.${min}${ext}"
  19. }
  20. hook_regression_tests()
  21. {
  22. default_hook_regression_tests "$@"
  23. # Run selftests
  24. sh "$1/tests/run.sh"
  25. }
  26. hook_post_documentation()
  27. {
  28. "$1"/maintenance/gen-doc.sh -r
  29. }
  30. project=pwman-python
  31. default_archives=py-sdist-xz
  32. makerelease "$@"