Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New version handling

git-svn-id: https://django-tagging.googlecode.com/svn/trunk@183 83e7428b-ec2a-0410-86f2-bf466d0e5e72
  • Loading branch information...
commit 772868f07b337aa2995a3488700d5815e9d3fc2f 1 parent effd577
@brosner authored
Showing with 19 additions and 9 deletions.
  1. +5 −7 setup.py
  2. +14 −2 tagging/__init__.py
View
12 setup.py
@@ -5,6 +5,10 @@
from distutils.command.install import INSTALL_SCHEMES
from distutils.core import setup
+import tagging
+
+
+
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
@@ -45,16 +49,10 @@ def fullsplit(path, result=None):
elif filenames:
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
-# Dynamically calculate the version based on tagging.VERSION
-version_tuple = (0, 4, 'pre')
-if version_tuple[2] is not None:
- version = "%d.%d_%s" % version_tuple
-else:
- version = "%d.%d" % version_tuple[:2]
setup(
name = 'django-tagging',
- version = version,
+ version = tagging.get_version(),
description = 'Generic tagging application for Django',
author = 'Jonathan Buchanan',
author_email = 'jonathan.buchanan@gmail.com',
View
16 tagging/__init__.py
@@ -1,10 +1,20 @@
-from tagging.managers import ModelTaggedItemManager, TagDescriptor
+VERSION = (0, 4, 0, "dev", 1)
-VERSION = (0, 4, 'pre')
+def get_version():
+ if VERSION[3] == "final":
+ return "%s.%s.%s" % (VERSION[0], VERSION[1], VERSION[2])
+ elif VERSION[3] == "dev":
+ if VERSION[2] == 0:
+ return "%s.%s.%s%s" % (VERSION[0], VERSION[1], VERSION[3], VERSION[4])
+ return "%s.%s.%s.%s%s" % (VERSION[0], VERSION[1], VERSION[2], VERSION[3], VERSION[4])
+ else:
+ return "%s.%s.%s%s" % (VERSION[0], VERSION[1], VERSION[2], VERSION[3])
+__version__ = get_version()
+
class AlreadyRegistered(Exception):
"""
@@ -22,6 +32,8 @@ def register(model, tag_descriptor_attr='tags',
Sets the given model class up for working with tags.
"""
+ from tagging.managers import ModelTaggedItemManager, TagDescriptor
+
if model in registry:
raise AlreadyRegistered("The model '%s' has already been "
"registered." % model._meta.object_name)
Please sign in to comment.
Something went wrong with that request. Please try again.