Last modified: 2014-11-15 06:42:35 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T73788, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71788 - version.getfileversion does not work on py3, and should be rewritten
version.getfileversion does not work on py3, and should be rewritten
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
All All
: Low minor
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks: pwbpy3
  Show dependency treegraph
 
Reported: 2014-10-08 10:20 UTC by John Mark Vandenberg
Modified: 2014-11-15 06:42 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description John Mark Vandenberg 2014-10-08 10:20:02 UTC
In verbose logging, the log is supposed to contain a list of the pywikibot modules loaded at startup, however on py3 it logs not modules.

The problem is the eval does not set local variable __version__

http://git.wikimedia.org/blob/pywikibot%2Fcore.git/9ca1b85c367b381947426c2615f4ab246e497518/pywikibot%2Fversion.py#L275

In addition, the algorithm is dodgy.

It checks every module name to see if it is a part of pywikibot, which is problematic if pywikibot has a module which has the same name as another package, and this approach also unnecessarily tries to stat many files which will not exist.

If it does find a pywikibot file, it reads the file to find __version__ even though Python has already loaded the module.  it then exec's the first line which contains __version__, assuming it is an assignment to __version__.

module versions could be merged into version.package_versions(), as it already supports different types of entries (builtins, standard library)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links