build_pip.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. ### Bash Environment Setup
  3. # http://redsymbol.net/articles/unofficial-bash-strict-mode/
  4. # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
  5. # set -o xtrace
  6. set -o errexit
  7. set -o errtrace
  8. set -o nounset
  9. set -o pipefail
  10. IFS=$'\n'
  11. REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
  12. if [[ -f "$REPO_DIR/.venv/bin/activate" ]]; then
  13. source "$REPO_DIR/.venv/bin/activate"
  14. else
  15. echo "[!] Warning: No virtualenv presesnt in $REPO_DIR/.venv, creating one now..."
  16. python3 -m venv --system-site-packages --symlinks $REPO_DIR/.venv
  17. fi
  18. cd "$REPO_DIR"
  19. echo "[*] Cleaning up build dirs"
  20. cd "$REPO_DIR"
  21. rm -Rf build dist
  22. echo "[+] Building sdist, bdist_wheel, and egg_info"
  23. rm -f archivebox/package.json
  24. cp package.json archivebox/package.json
  25. pdm self update
  26. pdm install
  27. pdm build
  28. pdm export --without-hashes -o ./pip_dist/requirements.txt
  29. cp dist/* ./pip_dist/
  30. echo
  31. echo "[√] Finished. Don't forget to commit the new sdist and wheel files in ./pip_dist/"