Created
June 13, 2016 06:37
-
-
Save plq/a4e383ef129618579f7cc86606c2b21d to your computer and use it in GitHub Desktop.
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
pap() { | |
python -c "import $1" || exit 1; | |
echo $(dirname "$(python -c "import $1; print $1.__file__")"); #" | |
} | |
prp() { | |
retval="$1"; | |
retval="$(pap "$retval")"; | |
[ -z "$retval" ] && exit 1; | |
while [ ! -e "$retval"/setup.py ]; do | |
retval="$( dirname "$retval" )"; | |
if [ "$PWD" == "/" ]; then | |
echo $1 icin setup.py bulunamadi; | |
exit 2; | |
fi | |
done; | |
echo "$retval"; | |
} | |
get_egg() { | |
package=$1; | |
proj_path="$(prp "$package")"; | |
(cd "$proj_path"; $PYTHON setup.py bdist_egg --exclude-source-files || exit 1;) || exit 1 | |
mv "$proj_path"/dist/*.egg runtime; | |
} | |
verbump() { | |
package=$1; | |
proj_path="$(prp "$package")"; | |
initfile="$proj_path/aa/__init__.py"; | |
vline=$(grep ^__version__ "$initfile"); | |
majmin=$(echo $vline | cut -d\' -f 2 | cut -d. -f1,2); | |
build=$(echo $vline | cut -d\' -f 2 | cut -d. -f3); | |
let "build+=1"; | |
sed -i "s/$vline/__version__ = '$majmin.$build'/g" "$initfile"; | |
git commit -m verbump "$initfile"; | |
} | |
# sampe usage for a project that depends on twisted trunk. | |
get_egg twisted | |
get_egg myproj | |
verbump myproj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment