Skip to content

Commit

Permalink
Fix version processing
Browse files Browse the repository at this point in the history
- First 3 elements of VERSION should be integer.
- Don't get upset with version.py non-existant, e.g. for version checked
  straight out of git.
  • Loading branch information
brianmay committed Feb 25, 2016
1 parent 7145cec commit 21719bd
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions guardian/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
from . import checks


from .version import version as __version__
VERSION = __version__.split(".")


def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
return '.'.join((str(each) for each in VERSION[:3]))
try:
from .version import version as __version__
__version__split__ = __version__.split(".")
VERSION = [int(each) for each in __version__split__[:3]] + __version__split__[3:]

def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
return '.'.join((str(each) for each in VERSION[:3]))
except ImportError:
pass


default_app_config = 'guardian.apps.GuardianConfig'
Expand Down

0 comments on commit 21719bd

Please sign in to comment.