Created
November 4, 2010 10:21
-
-
Save mgax/662307 to your computer and use it in GitHub Desktop.
Extract an SVN revision number from `git log` and then invoke `python setup.py sdist`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment