Skip to content

Commit 772868f

Browse files
committed
New version handling
git-svn-id: https://django-tagging.googlecode.com/svn/trunk@183 83e7428b-ec2a-0410-86f2-bf466d0e5e72
1 parent effd577 commit 772868f

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

setup.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
from distutils.command.install import INSTALL_SCHEMES
66
from distutils.core import setup
77

8+
import tagging
9+
10+
11+
812
def fullsplit(path, result=None):
913
"""
1014
Split a pathname into components (the opposite of os.path.join) in a
@@ -45,16 +49,10 @@ def fullsplit(path, result=None):
4549
elif filenames:
4650
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
4751

48-
# Dynamically calculate the version based on tagging.VERSION
49-
version_tuple = (0, 4, 'pre')
50-
if version_tuple[2] is not None:
51-
version = "%d.%d_%s" % version_tuple
52-
else:
53-
version = "%d.%d" % version_tuple[:2]
5452

5553
setup(
5654
name = 'django-tagging',
57-
version = version,
55+
version = tagging.get_version(),
5856
description = 'Generic tagging application for Django',
5957
author = 'Jonathan Buchanan',
6058
author_email = '[email protected]',

tagging/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
from tagging.managers import ModelTaggedItemManager, TagDescriptor
1+
VERSION = (0, 4, 0, "dev", 1)
22

33

44

5-
VERSION = (0, 4, 'pre')
5+
def get_version():
6+
if VERSION[3] == "final":
7+
return "%s.%s.%s" % (VERSION[0], VERSION[1], VERSION[2])
8+
elif VERSION[3] == "dev":
9+
if VERSION[2] == 0:
10+
return "%s.%s.%s%s" % (VERSION[0], VERSION[1], VERSION[3], VERSION[4])
11+
return "%s.%s.%s.%s%s" % (VERSION[0], VERSION[1], VERSION[2], VERSION[3], VERSION[4])
12+
else:
13+
return "%s.%s.%s%s" % (VERSION[0], VERSION[1], VERSION[2], VERSION[3])
614

715

16+
__version__ = get_version()
17+
818

919
class AlreadyRegistered(Exception):
1020
"""
@@ -22,6 +32,8 @@ def register(model, tag_descriptor_attr='tags',
2232
Sets the given model class up for working with tags.
2333
"""
2434

35+
from tagging.managers import ModelTaggedItemManager, TagDescriptor
36+
2537
if model in registry:
2638
raise AlreadyRegistered("The model '%s' has already been "
2739
"registered." % model._meta.object_name)

0 commit comments

Comments
 (0)