python setyp.py sdist SVN Revision

Extract an SVN revision number from `git log` and then invoke `python setup.py sdist`

by humancoder 1 year, 6 months ago and tagged with: bash egg python
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
#!/bin/bash
# Extract an SVN revision number from `git log` and then invoke `python setup.py sdist`
prepare_cmd() {
    [[ $PYTHON = '' ]] && {
        PYTHON='python'
    }
    REV=`git log -1 | grep -n git-svn-id | perl -e '$_ = <> and /@(\d+) / and print $1'` || {
        echo 'failed extract_gitsvn_version'
        exit
    }
    CMD="$PYTHON setup.py egg_info -bdev-$REV sdist"
}
case "$1" in
  -h)
    echo "usage: $0 [-n | -h]"
    echo "        -n Dry-run"
    echo "        -h Print help message"
    ;;
  -n)
    prepare_cmd
    echo $CMD
    ;;
  *)
    prepare_cmd
    echo $CMD
    $CMD
    ;;
esac
exit 0

Currently 0 comments

To post a comment, you must login.