Skip to content

Commit

Permalink
Set version number in __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
Duologic committed Mar 18, 2016
1 parent 7a4e4e9 commit d4f49bb
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions djtriggers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
import os, subprocess, datetime

def get_git_version():
git_dir = os.path.abspath(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'..',
'.git'
)
)
try:
# Python 2.7 has subprocess.check_output
# 2.6 needs this longer version
git_info = subprocess.Popen(['git', '--git-dir=%s' % git_dir, 'log', '--pretty=%ct %h', '-1'], stdout=subprocess.PIPE).communicate()[0].split()
git_time = datetime.datetime.fromtimestamp(float(git_info[0]))
except Exception:
git_time = datetime.datetime.now()
git_info = ('', '0000000')
return git_time.strftime('%Y.%m.%d') + '.' + git_info[1]

__version__ = get_git_version()
__version__ = '1.0.1'

0 comments on commit d4f49bb

Please sign in to comment.