jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/405720 )

Change subject: pywikibot.version.getversion_package: Return empty string as 
hash value
......................................................................


pywikibot.version.getversion_package: Return empty string as hash value

Since we have removed __version__ variables, get_module_version(pywikibot)
will always return None. The None value causes failure later when data['hsh']
is sliced on line 85.

Also since Python 3.4 __file__ is always absolute.[1] This was causing a
discrepancy between the results of python2 and python3.

[1]: https://docs.python.org/3.4/whatsnew/3.4.html#other-language-changes

Bug: T185491
Change-Id: I4dacaf7c687b29f64cfb9a1db855a452c1a58416
---
M pywikibot/version.py
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved



diff --git a/pywikibot/version.py b/pywikibot/version.py
index 3eecc93..b76f2a6 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -35,7 +35,7 @@
 import pywikibot
 
 from pywikibot import config2 as config
-from pywikibot.tools import deprecated, PY2
+from pywikibot.tools import deprecated, PY2, PYTHON_VERSION
 
 if not PY2:
     basestring = (str, )
@@ -366,7 +366,7 @@
         - hash (git hash for the current revision of 'pywikibot/__init__.py')
     @rtype: C{tuple} of four C{str}
     """
-    hsh = get_module_version(pywikibot)
+    hsh = ''
     date = get_module_mtime(pywikibot).timetuple()
 
     tag = 'pywikibot/__init__.py'
@@ -453,6 +453,8 @@
     """
     if hasattr(module, '__file__') and os.path.exists(module.__file__):
         filename = module.__file__
+        if PYTHON_VERSION < (3, 4):
+            filename = os.path.abspath(filename)
         if filename[-4:-1] == '.py' and os.path.exists(filename[:-1]):
             filename = filename[:-1]
         program_dir = _get_program_dir()

-- 
To view, visit https://gerrit.wikimedia.org/r/405720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4dacaf7c687b29f64cfb9a1db855a452c1a58416
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: Zoranzoki21 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to