File: make_release_tarball.bash

package info (click to toggle)
python-pyflow 1.1.20-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 996 kB
  • sloc: python: 4,154; sh: 219; ansic: 15; makefile: 5
file content (65 lines) | stat: -rwxr-xr-x 1,236 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash

#
# this script makes the pyflow release tarball assuming it's being called in the git repo
# already checked out to the targeted version
#
# the tarball is written to the callers cwd
#

set -o nounset
set -o xtrace
set -o errexit

pname_root=""
if [ $# -gt 1 ]; then
    echo "usage: $0 [rootname]"
    exit 2
elif [ $# == 1 ]; then
    pname_root=$1
fi


get_abs_path() {
    (cd $1; pwd -P)
}


script_dir=$(get_abs_path $(dirname $0))
outdir=$(pwd)
echo $outdir

cd $script_dir
echo $script_dir
gitversion=$(git describe | sed s/^v//)

if [ "$pname_root" == "" ]; then
    pname_root=pyflow-$gitversion
fi

pname=$outdir/$pname_root

cd ..

# use archive instead of copy so that we clean up any tmp files in the working directory:
git archive --prefix=$pname_root/ HEAD:pyflow/ | tar -x -C $outdir

# make version number substitutions:
cat pyflow/src/pyflow.py |\
sed "s/pyflowAutoVersion = None/pyflowAutoVersion = \"$gitversion\"/" >|\
$pname/src/pyflow.py

cat pyflow/README.md |\
sed "s/\${VERSION}/$gitversion/" >|\
$pname/README.md

cat pyflow/setup.py |\
sed "s/\${VERSION}/$gitversion/" >|\
$pname/setup.py

chmod +x $pname/src/pyflow.py

cd $outdir
tar -cz $pname_root -f $pname.tar.gz
rm -rf $pname