#2191: Add a `__version__` attribute to tg
-------------------------+--------------------------------------------------
Reporter: pitrou | Owner: mramm
Type: enhancement | Status: new
Priority: normal | Milestone: 2.0b6
Component: TurboGears | Version: trunk
Severity: trivial | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by pitrou):
This is a code snippet I personally use:
{{{
__versioninfo__ = (0, 1, 7)
base_version = '.'.join(map(str, __versioninfo__))
full_version = base_version
try:
import pkg_resources
except ImportError:
pass
else:
try:
full_version = pkg_resources.get_distribution("hgsvn").version
except pkg_resources.DistributionNotFound:
pass
__version__ = full_version
}}}
(replace "hgsvn" with "TurboGears2" or something. The ImportError dance
allows the code to work even without an explicit install. You can yank it
if you don't support this scenario)
--
Ticket URL: <http://trac.turbogears.org/ticket/2191#comment:4>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---