Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added django_notices.__version__ and django_notices.__build__

  • Loading branch information...
commit e9029090ceb8a438a49b8781baf86be45864ea53 1 parent abf5c06
David Cramer authored
Showing with 31 additions and 1 deletion.
  1. +28 −0 django_notices/__init__.py
  2. +3 −1 setup.py
View
28 django_notices/__init__.py
@@ -1 +1,29 @@
+import os.path
+
+__version__ = (0, 1)
+
+def _get_git_revision(path):
+ revision_file = os.path.join(path, 'refs', 'heads', 'master')
+ if not os.path.exists(revision_file):
+ return None
+ fh = open(revision_file, 'r')
+ try:
+ return fh.read()
+ finally:
+ fh.close()
+
+def get_revision():
+ """
+ :returns: Revision number of this branch/checkout, if available. None if
+ no revision number can be determined.
+ """
+ package_dir = os.path.dirname(__file__)
+ checkout_dir = os.path.normpath(os.path.join(package_dir, '..'))
+ path = os.path.join(checkout_dir, '.git')
+ if os.path.exists(path):
+ return _get_git_revision(path)
+ return None
+
+__build__ = get_revision()
+
from constants import *
View
4 setup.py
@@ -2,9 +2,11 @@
from setuptools import setup, find_packages
+import django_notices
+
setup(
name='django-notices',
- version='0.1',
+ version=".".join(map(str, django_notices.__version__)),
author='David Cramer',
author_email='dcramer@gmail.com',
url='http://github.com/dcramer/django-notices',

0 comments on commit e902909

Please sign in to comment.
Something went wrong with that request. Please try again.