[Checkins] SVN: grok/branches/ulif-docs2sphinx/doc/conf.py Use `pkg_resources` to get version number.
Uli Fouquet
uli at gnufix.de
Tue Dec 21 20:04:53 EST 2010
Log message for revision 119049:
Use `pkg_resources` to get version number.
Changed:
U grok/branches/ulif-docs2sphinx/doc/conf.py
-=-
Modified: grok/branches/ulif-docs2sphinx/doc/conf.py
===================================================================
--- grok/branches/ulif-docs2sphinx/doc/conf.py 2010-12-22 00:54:45 UTC (rev 119048)
+++ grok/branches/ulif-docs2sphinx/doc/conf.py 2010-12-22 01:04:52 UTC (rev 119049)
@@ -12,20 +12,10 @@
# show the default value as assigned to them.
import sys
+import pkg_resources
from os import path, curdir
-import re
-
-version = 'Unknown'
-setupfilepath = path.join(path.dirname(path.abspath(curdir)), 'setup.py')
-reg = re.compile("^\s*version = .(.+).,.*")
-for line in open(setupfilepath, 'r').read().split('\n'):
- m = reg.match(line)
- if m:
- version = m.groups()[0]
-
-
# If your extensions are in another directory, add it here.
#sys.path.append('some/directory')
@@ -53,9 +43,11 @@
# other places throughout the built documents.
#
# The short X.Y version.
-version = version
+version = pkg_resources.get_distribution('grok').version
# The full version, including alpha/beta/rc tags.
release = version
+if release.endswith('dev'):
+ release = '%s (unreleased)' % release
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
More information about the checkins
mailing list