From 84e5b1ed01aea547bc90b1abeea1c90a5b3d8051 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Thu, 6 Dec 2012 14:01:14 -0500 Subject: [PATCH] Simplify version artifact to txt file (#410) --- release.sh | 25 +++++++++++++------------ setup.py | 12 ++++++++++-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/release.sh b/release.sh index f5202f1bb8..bb5107bcd1 100755 --- a/release.sh +++ b/release.sh @@ -66,31 +66,32 @@ if [ $1 ]; then confirm "Tag and push version $1?" if [ $? -eq 0 ]; then - # Fix the version. - # ================ + # Bump the version. + # ================= - sed -e "s/~~VERSION~~/$1/" -i '' gittip/__init__.py - git ci gittip/__init__.py \ - -m"Setting version to $1 in gittip/__init__.py." + printf "$1" > www/version.txt + git ci www/version.txt -m"Bump version to $1" git tag $1 # Deploy to Heroku. # ================= - # If this fails we still want to reset the version, so modify bash - # error handling around this call. + # If this fails we still want to bump the version again, so modify + # bash error handling around this call. set +e git push heroku set -e - # Change the version back. - # ======================== + # Bump the version again. + # ======================= + # We're using a Pythonic convention here by using -dev to mean, "a + # dev version following $whatever." We escape the dash for bash's + # sake - sed -e "s/$1/~~VERSION~~/" -i '' gittip/__init__.py - git ci gittip/__init__.py \ - -m"Resetting version in gittip/__init__.py." + printf "\055dev" >> www/version.txt + git ci www/version.txt -m"Bump version to $1\055dev" fi fi diff --git a/setup.py b/setup.py index 5bfe79291e..499c43c5d1 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,16 @@ +import os from setuptools import setup, find_packages -from gittip import __version__ + + +def get_version(): + try: + return open(os.path.join('www', 'version.txt')).read().strip() + except OSError: + return 'n/a' + setup( name='gittip' - , version=__version__ + , version=get_version() , packages=find_packages() , entry_points = { 'console_scripts' : [ 'payday=gittip.cli:payday'