Skip to content

Instantly share code, notes, and snippets.

@plq

plq/pap.sh

Created Jun 13, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.