File: release-pypi.sh

package info (click to toggle)
vit 2.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,012 kB
  • sloc: python: 5,028; sh: 103; makefile: 4
file content (42 lines) | stat: -rwxr-xr-x 1,168 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash

# Convenience script to handle preparing for PyPi release, and printing out the
# commands to execute it.

execute() {
  local update_build_release_packages="pip install --upgrade wheel build twine"
  local clean="rm -rfv dist/ build/"
  local build="python -m build"
  local test_pypi_upload="python -m twine upload --repository testpypi dist/*"
  local pypi_upload="python -m twine upload --skip-existing dist/*"

  echo "Updating build and release packages with command:"
  echo "  ${update_build_release_packages}"
  ${update_build_release_packages}

  if [ $? -eq 0 ]; then
    echo "Cleaning build environment with command:"
    echo "  ${clean}"
    ${clean}
    if [ $? -eq 0 ]; then
      echo "Building release with command:"
      echo "  ${build}"
      ${build}
      if [ $? -eq 0 ]; then
        echo "Build successful"
        echo
        echo "Test release with command:"
        echo "  ${test_pypi_upload}"
        echo
        echo "Release with command:"
        echo "  ${pypi_upload}"
      fi
    fi
  fi
}

if [ -d vit ] && [ -r setup.py ]; then
  execute
else
  echo "ERROR: must run script from VIT repository root"
fi