http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10910
Revision: 10910 Author: drtrigon Date: 2013-01-13 16:59:32 +0000 (Sun, 13 Jan 2013) Log Message: ----------- bug fix; correct determination of program_dir (analog to trunk)
Modified Paths: -------------- branches/rewrite/pywikibot/version.py
Modified: branches/rewrite/pywikibot/version.py =================================================================== --- branches/rewrite/pywikibot/version.py 2013-01-13 16:59:07 UTC (rev 10909) +++ branches/rewrite/pywikibot/version.py 2013-01-13 16:59:32 UTC (rev 10910) @@ -120,8 +120,10 @@ # without importing it (thus can be done for any file) # def getfileversion(filename): + _program_dir = os.path.normpath(os.path.dirname(sys.argv[0])) + _program_dir = _program_dir.rstrip(os.path.basename(_program_dir)) __version__ = None - fn = os.path.abspath(os.path.join(os.curdir, filename)) + fn = os.path.join(_program_dir, filename) if os.path.exists(fn): for line in open(fn, 'r').readlines(): if line.find('__version__') == 0:
pywikipedia-svn@lists.wikimedia.org