irongit

A combination of vim and bash that I find useful

pipd now updates version number in setup.py automatically

huncholanehuncholaneauthored
parent d787bdecommit 97b08ead7d0d13d052d7bc07f304f5e5cc902ba8Browse files

2 files changed, +18 -1

+18-0gfuncs.sh
@@ -143,3 +143,21 @@ function dev {
143143 done
144144 cd $start
145145 }
146+function pipd () {
147+ updatesetupversion
148+ rm -rf dist *.egg-info build
149+ python setup.py bdist_wheel
150+ pm twine upload --skip-existing dist/*
151+ rm -rf dist *.egg-info build
152+ gcom `cat setup.py | grep version`
153+ git push origin main
154+}
155+function updatesetupversion () {
156+ local num=`cat setup.py | grep version | tr -dc '0-9.'`
157+ local updatePart=`echo $num | grep -oE '[^.]+$'`
158+ local updatedPart=$((updatePart+1))
159+ local firstPart=`echo $num | grep -oE -m 0 '[^.]+$'`
160+ local update=$((firstPart)).$updatedPart
161+ echo $update
162+ sed -i "s/$num/$update/g" setup.py
163+}
+0-1ghost.sh
@@ -31,6 +31,5 @@ alias dwipe='~/.ghost/dwipe.sh'
3131 alias Ggit='vim ~/.gitconfig'
3232 alias ddev='docker compose -f dev-compose.yml up -d --remove-orphans'
3333 alias Gcd='cd ~/.ghost'
34-alias pipd='rm -rf dist *.egg-info && python setup.py bdist_wheel && pm twine upload dist/* ; rm -rf dist *.egg-info build'
3534
3635 source ~/.ghost/gfuncs.sh