Commits

German Larrain committed e5264b5

utils.version.get_version: now returns a PEP 386 compliant version number.

Replaced 'get_hg_changeset' with 'get_hg_tip_timestamp' for the string section
after ".dev".

Comments (0)

Files changed (1)

ars/utils/version.py

 
 
 def get_version(version=None, length='full'):
-	"""Returns a (almost?) PEP 386-compliant version number from `version`.
+	"""Return a PEP 386-compliant version number from ``version``.
 
 	:param version: the value to format, expressed as a tuple of strings, of
 		length 5, with the element before last (i.e. version[3]) equal to
 	:rtype: str
 
 	>>> get_version(version=(0, 4, 0, 'alpha', 0))
-	0.4.dev1a4b04cf687a
-	>>> get_version(version=(0, 4, 0, 'alpha', 0))
-	0.4.dev1a4b04cf687a+
+	0.4.dev20130401011455
 	>>> get_version(version=(0, 4, 0, 'alpha', 0), length='medium')
 	0.4.dev
 	>>> get_version(version=(0, 4, 0, 'alpha', 0), length='short')
 
 	sub = ''
 	if version[3] == 'alpha' and version[4] == 0:
-		hg_changeset = get_hg_changeset()
+		hg_timestamp = get_hg_tip_timestamp()
 		if length == 'full':
-			if hg_changeset:
-				sub = '.dev%s' % hg_changeset
+			if hg_timestamp:
+				sub = '.dev%s' % hg_timestamp
 		else:
 			sub = '.dev'