diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2014-03-01 18:10:33 +0100 |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2014-03-01 18:10:33 +0100 |
commit | ea763a5021b337ddc4ca5c93306dd80d0a124d96 (patch) | |
tree | 5bb4a59b02a435730e28b97b1dabfc2a1aacb942 /docs/conf.py | |
parent | 3702674841b437447f049575dd6564700a8c65cb (diff) | |
download | psutil-ea763a5021b337ddc4ca5c93306dd80d0a124d96.tar.gz |
(doc) fix sphinx warnings; also provide a better routine to retrieve psutil version
Diffstat (limited to 'docs/conf.py')
-rw-r--r-- | docs/conf.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/docs/conf.py b/docs/conf.py index 90d6897f..c5a30372 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,12 +13,31 @@ # serve to show the default. import datetime +import os -import psutil PROJECT_NAME = u"psutil" AUTHOR = u"Giampaolo Rodola'" THIS_YEAR = str(datetime.datetime.now().year) +HERE = os.path.abspath(os.path.dirname(__file__)) + +def get_version(): + INIT = os.path.abspath(os.path.join(HERE, '../psutil/__init__.py')) + f = open(INIT, 'r') + try: + for line in f: + if line.startswith('__version__'): + ret = eval(line.strip().split(' = ')[1]) + assert ret.count('.') == 2, ret + for num in ret.split('.'): + assert num.isdigit(), ret + return ret + else: + raise ValueError("couldn't find version string") + finally: + f.close() + +VERSION = get_version() # -- General configuration ----------------------------------------------------- @@ -56,7 +75,7 @@ copyright = u'2009-%s, %s' % (THIS_YEAR, AUTHOR) # built documents. # # The short X.Y version. -version = psutil.__version__ +version = VERSION # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. |