jenkins-bot has submitted this change and it was merged.
Change subject: Bug 66063: Disable git version network request
......................................................................
Bug 66063: Disable git version network request
The online git repository query is unnecessary startup activity,
and it uses a different http routine which introduces additional
startup issues.
The online repo version can be determined from the time when the
command was run, which is I02e97f59f07e1321c69181e2dc10a6c919603f9b
Change-Id: I3e2bd55dfdd523ce6ecc54ff4168c157a1b25318
---
M pywikibot/bot.py
M pywikibot/config2.py
M pywikibot/version.py
3 files changed, 23 insertions(+), 10 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 2c2e2b5..e85f836 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -258,12 +258,16 @@
# new framework release/revision? (handleArgs needs to be called first)
try:
- log(u'VERSION: %s' % unicode((version.getversion().strip(),
- version.getversion_onlinerepo(),
- site.live_version())))
+ log(u'VERSION: %s' %
+ version.getversion(online=config.log_pywiki_repo_version).strip())
except version.ParseError:
exception()
+ if config.log_pywiki_repo_version:
+ log(u'PYWIKI REPO VERSION: %s' %
unicode(version.getversion_onlinerepo()))
+
+ log(u'SITE VERSION: %s' % unicode(site.live_version()))
+
# system
if hasattr(os, 'uname'):
log(u'SYSTEM: %s' % unicode(os.uname()))
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 18b9ca6..ab29bb0 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -315,6 +315,8 @@
logfilecount = 5
# set to 1 (or higher) to generate "informative" messages to terminal
verbose_output = 0
+# set to True to fetch the pywiki version online
+log_pywiki_repo_version = False
# if True, include a lot of debugging info in logfile
# (overrides log setting above)
debug_log = []
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 6d0d30d..ab455f3 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -28,14 +28,21 @@
return _program_dir
-def getversion():
+def getversion(online=True):
+ """Return a pywikibot version string
+ @param online: (optional) Include information obtained online
+ """
data = dict(getversiondict()) # copy dict to prevent changes in 'chache'
- try:
- hsh2 = getversion_onlinerepo()
- hsh1 = data['hsh']
- data['cmp_ver'] = 'OUTDATED' if hsh1 != hsh2 else 'ok'
- except Exception:
- data['cmp_ver'] = 'n/a'
+ data['cmp_ver'] = 'n/a'
+
+ if online:
+ try:
+ hsh2 = getversion_onlinerepo()
+ hsh1 = data['hsh']
+ data['cmp_ver'] = 'OUTDATED' if hsh1 != hsh2 else
'ok'
+ except Exception:
+ pass
+
data['hsh'] = data['hsh'][:7] # make short hash from full hash
return '%(tag)s (%(hsh)s, %(rev)s, %(date)s, %(cmp_ver)s)' % data
--
To view, visit
https://gerrit.wikimedia.org/r/137009
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3e2bd55dfdd523ce6ecc54ff4168c157a1b25318
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>