jenkins-bot has submitted this change and it was merged.
Change subject: Allow travis failures on python 2.6
......................................................................
Allow travis failures on python 2.6
Python 2.6 setup is registering a fail on travis builds
due to SkipTest occurring in setUpClass. The same SkipTest
is registered as a skipped test on python 2.7 and doesnt
cause the build to be considered a failure.
https://travis-ci.org/wikimedia/pywikibot-core/builds/31882466
travis allows builds to fail without the changeset being considered
a failure. The builds allowed to fail are displayed as red, with
the log to allow issues to be investigated and fixed without putting
a halt on merging of changesets.
Change-Id: I0db9294154f06d650928b144390b383144d87d91
---
M .travis.yml
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index db01511..b1e1007 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,6 +42,10 @@
- LANGUAGE=ar FAMILY=wikipedia PYSETUP_TEST_EXTRAS=1
- LANGUAGE=test FAMILY=wikidata
+matrix:
+ allow_failures:
+ - python: "2.6"
+
notifications:
irc:
channels:
--
To view, visit https://gerrit.wikimedia.org/r/152272
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0db9294154f06d650928b144390b383144d87d91
Gerrit-PatchSet: 1
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: This fixes the regression introduced by I0f5f1d68d686fdbfe90393ae93ebaff9cd11ffe6
......................................................................
This fixes the regression introduced by
I0f5f1d68d686fdbfe90393ae93ebaff9cd11ffe6
Change-Id: I10417e4a4297977d8879a387ad06d439c4028a37
---
M pywikibot/version.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/version.py b/pywikibot/version.py
index cea522f..8826a4d 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -151,7 +151,7 @@
if remote_pos == -1:
tag = '?'
else:
- s = tag.find('url = ', )
+ s = tag.find('url = ', remote_pos)
e = tag.find('\n', s)
tag = tag[(s + 6):e]
t = tag.strip().split('/')
--
To view, visit https://gerrit.wikimedia.org/r/152170
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I10417e4a4297977d8879a387ad06d439c4028a37
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: improve translatability of 'archivebot-older-than'
......................................................................
improve translatability of 'archivebot-older-than'
by adding a 'duration' parameter
Per mailing list:
http://comments.gmane.org/gmane.comp.python.pywikipediabot.general/14160
Corresponding change in the bot script:
Ie4699550def701a728abaca3e62287e1c36ce3b0
Change-Id: I507b0b38a87fe8e97b850a71d9c1764ec16fbeb1
---
M archivebot.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/archivebot.py b/archivebot.py
index 05e99e1..6a5fe56 100644
--- a/archivebot.py
+++ b/archivebot.py
@@ -5,14 +5,14 @@
'archivebot-archive-full': u'(ARCHIVE FULL)',
'archivebot-archive-summary': u'Bot: Archiving %(count)d {{PLURAL:%(count)d|thread|threads}} from [[%(from)s]].',
'archivebot-archiveheader': u'{{talkarchive}}',
- 'archivebot-older-than': u'older than',
+ 'archivebot-older-than': u'older than %(duration)s',
'archivebot-page-summary': u'Bot: Archiving %(count)d {{PLURAL:%(count)d|thread|threads}} (%(why)s) to %(archives)s.',
},
# Author: Csisc
# Author: McDutchie
# Author: Shirayuki
'qqq': {
- 'archivebot-older-than': u'Followed by " " and timestamp (elapsed time).\n{{Identical|Older than}}',
+ 'archivebot-older-than': u'"duration" is the localized form of the elapsed time.\n{{Identical|Older than}}',
'archivebot-page-summary': u'Summary message when the bot removes threads from a talk page for archiving.',
'archivebot-archiveheader': u'Template that will be put on new archive pages as the header.',
'archivebot-archive-full': u'Appended to the summary.',
--
To view, visit https://gerrit.wikimedia.org/r/152138
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I507b0b38a87fe8e97b850a71d9c1764ec16fbeb1
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: use the new version of 'archivebot-older-than'
......................................................................
use the new version of 'archivebot-older-than'
with the 'duration' parameter
per mailing list:
http://comments.gmane.org/gmane.comp.python.pywikipediabot.general/14160
corresponding change in the i18n file:
I507b0b38a87fe8e97b850a71d9c1764ec16fbeb1
Change-Id: Ie4699550def701a728abaca3e62287e1c36ce3b0
---
M scripts/archivebot.py
1 file changed, 3 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index ba37a89..5b10838 100644
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -242,9 +242,10 @@
# return 'unsigned'
maxage = str2time(re_t.group(1))
if self.now - self.timestamp > maxage:
- msg = i18n.twtranslate(self.code, 'archivebot-older-than')
duration = str2localized_duration(archiver.site, re_t.group(1))
- return u'%s %s' % (msg, duration)
+ return i18n.twtranslate(self.code,
+ 'archivebot-older-than',
+ {'duration': duration})
return ''
--
To view, visit https://gerrit.wikimedia.org/r/152139
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie4699550def701a728abaca3e62287e1c36ce3b0
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
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: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: update Wikibase item on category rename
......................................................................
update Wikibase item on category rename
The 'wikibase' variable in CategoryMoveRobot is True by default,
but can be turned off by passing the '-nowb' argument.
If the bot cannot move categories (thus updating the item
automatically) and no registered user can be found for the
Wikibase repository, pywikibot.NoUsername is raised
and caught in main().
other unrelated parts of the code have not and will not be touched
bug: 64815
Change-Id: Idaaa272b30ad2e3372e70e0c6af4995998546d2d
---
M scripts/category.py
1 file changed, 36 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index 6f143fe..2d3152b 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -420,7 +420,8 @@
def __init__(self, oldcat, newcat=None, batch=False, comment='',
inplace=False, move_oldcat=True, delete_oldcat=True,
title_regex=None, history=False, pagesonly=False,
- deletion_comment=DELETION_COMMENT_AUTOMATIC):
+ deletion_comment=DELETION_COMMENT_AUTOMATIC,
+ wikibase=True):
"""Store all given parameters in the objects attributes.
@param oldcat: The move source.
@@ -444,8 +445,11 @@
delete that is also used for move.
If the value is not recognized, it's interpreted as
DELETION_COMMENT_AUTOMATIC.
+ @param wikibase: If True, update the Wikibase item of the
+ old category.
"""
self.site = pywikibot.Site()
+ self.can_move_cats = ('move-categorypages' in self.site.userinfo['rights'])
# Create attributes for the categories and their talk pages.
self.oldcat = self._makecat(oldcat)
self.oldtalk = self.oldcat.toggleTalkPage()
@@ -463,6 +467,16 @@
self.title_regex = title_regex
self.history = history
self.pagesonly = pagesonly
+ self.wikibase = wikibase
+
+ if not self.can_move_cats:
+ repo = self.site.data_repository()
+ if repo.username() is None and self.wikibase:
+ # The bot can't move categories nor update the Wikibase repo
+ raise pywikibot.NoUsername(u"The 'wikibase' option is turned on"
+ u" and %s has no registered username."
+ % repo)
+
template_vars = {'oldcat': self.oldcat.title(withNamespace=False)}
if self.newcat:
template_vars.update({
@@ -509,7 +523,7 @@
- _delete()
"""
if self.newcat and self.move_oldcat and not self.newcat.exists():
- if "move-categorypages" in self.site.userinfo["rights"]:
+ if self.can_move_cats:
oldcattitle = self.oldcat.title()
self.oldcat.move(self.newcat.title(), reason=self.comment,
movetalkpage=True)
@@ -517,6 +531,8 @@
else:
self._movecat()
self._movetalk()
+ if self.wikibase:
+ self._update_wikibase_item()
if self.history:
self._hist()
self._change(pagegenerators.CategorizedPageGenerator(self.oldcat))
@@ -589,6 +605,19 @@
{'newcat': self.newcat.title(),
'title': self.newcat.title()})
self.oldtalk.move(self.newtalk.title(), comment)
+
+ def _update_wikibase_item(self):
+ """Private function to update the Wikibase item for the category.
+
+ Do not use this function from outside the class.
+ """
+ if self.oldcat.exists():
+ item = pywikibot.ItemPage.fromPage(self.oldcat)
+ if item.exists():
+ comment = i18n.twtranslate(self.site, 'category-was-moved',
+ {'newcat': self.newcat.title(),
+ 'title': self.newcat.title()})
+ item.setSitelink(self.newcat, summary=comment)
def _hist(self):
"""Private function to copy the history of the to-be-deleted category.
@@ -964,6 +993,7 @@
recurse = False
titleRegex = None
pagesonly = False
+ wikibase = True
withHistory = False
rebuild = False
depth = 5
@@ -1023,6 +1053,8 @@
recurse = True
elif arg == '-pagesonly':
pagesonly = True
+ elif arg == '-nowb':
+ wikibase = False
elif arg == '-create':
create_pages = True
elif arg == '-redirect':
@@ -1085,7 +1117,8 @@
title_regex=titleRegex,
history=withHistory,
pagesonly=pagesonly,
- deletion_comment=deletion_comment)
+ deletion_comment=deletion_comment,
+ wikibase=wikibase)
elif action == 'tidy':
catTitle = pywikibot.input(u'Which category do you want to tidy up?')
bot = CategoryTidyRobot(catTitle, catDB)
--
To view, visit https://gerrit.wikimedia.org/r/148539
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idaaa272b30ad2e3372e70e0c6af4995998546d2d
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
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: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Nullzero <nullzero.free(a)gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Log package versions
......................................................................
Log package versions
The version of major dependencies 'httplib2' and 'mwparserfromhell'
shoud be written to the log, and included in the script version.py.
In verbose mode it is helpful to see what other major packages are
being automatically loaded into the python environment, and their
versions.
Move the online startup checks after the local checks.
Change-Id: Iae9f73b23ab1eb1a4acce46a690c0b4f9f9396a8
---
M pywikibot/bot.py
M pywikibot/version.py
M scripts/version.py
3 files changed, 132 insertions(+), 7 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 78e291a..6ab690f 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -19,7 +19,6 @@
# all output goes thru python std library "logging" module
import os
-import os.path
import sys
import re
import json
@@ -268,22 +267,48 @@
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()))
+ all_modules = sys.modules.keys()
+
+ # These are the main dependencies of pywikibot.
+ check_package_list = ['httplib2', 'mwparserfromhell']
+
+ # report all imported packages
+ if config.verbose_output:
+ check_package_list += all_modules
+
+ packages = version.package_versions(check_package_list)
+
+ log(u'PACKAGES:')
+ for name in sorted(packages.keys()):
+ info = packages[name]
+ if 'path' not in info:
+ if 'type' in info:
+ info['path'] = '[' + info['type'] + ']'
+ else:
+ info['path'] = '[path unknown]'
+ if 'ver' not in info:
+ info['ver'] = '??'
+ if 'err' in info:
+ log(u' %(name)s: %(err)s' % info)
+ else:
+ log(u' %(name)s (%(path)s) = %(ver)s' % info)
+
# imported modules
log(u'MODULES:')
- for item in list(sys.modules.keys()):
+ for item in list(all_modules):
ver = version.getfileversion('%s.py' % item.replace('.', '/'))
if ver:
log(u' %s' % ver)
+ 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()))
+
# messages on bot discussion page?
if site.logged_in():
if site.messages():
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 26bc0dc..e607c62 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -216,3 +216,101 @@
return u'%s %s %s' % (filename, __version__[5:-1][:7], mtime)
else:
return None
+
+
+def package_versions(modules=None, builtins=False, standard_lib=None):
+ """ Retrieve package version information.
+
+ When builtins or standard_lib are None, they will be included only
+ if a version was found in the package.
+
+ @param modules: Modules to inspect
+ @type modules: list of strings
+ @param builtins: Include builtins
+ @type builtins: Boolean, or None for automatic selection
+ @param standard_lib: Include standard library packages
+ @type standard_lib: Boolean, or None for automatic selection
+ """
+ import sys
+
+ if not modules:
+ modules = sys.modules.keys()
+
+ import distutils.sysconfig
+ std_lib_dir = distutils.sysconfig.get_python_lib(standard_lib=True)
+
+ root_packages = set([key.split('.')[0]
+ for key in modules])
+
+ builtin_packages = set([name.split('.')[0] for name in root_packages
+ if name in sys.builtin_module_names or
+ '_' + name in sys.builtin_module_names])
+
+ # Improve performance by removing builtins from the list if possible.
+ if builtins is False:
+ root_packages = list(root_packages - builtin_packages)
+
+ std_lib_packages = []
+
+ paths = {}
+ data = {}
+
+ for name in root_packages:
+ try:
+ package = __import__(name, level=0)
+ except Exception as e:
+ data[name] = {'name': name, 'err': e}
+ continue
+
+ info = {'package': package, 'name': name}
+
+ if name in builtin_packages:
+ info['type'] = 'builtins'
+
+ if '__file__' in package.__dict__:
+ # Determine if this file part is of the standard library.
+ if os.path.normcase(package.__file__).startswith(
+ os.path.normcase(std_lib_dir)):
+ std_lib_packages.append(name)
+ if standard_lib is False:
+ continue
+ info['type'] = 'standard libary'
+
+ # Strip '__init__.py' from the filename.
+ path = package.__file__
+ if '__init__.py' in path:
+ path = path[0:path.index('__init__.py')]
+
+ info['path'] = path
+ assert(path not in paths)
+ paths[path] = name
+
+ if '__version__' in package.__dict__:
+ info['ver'] = package.__version__
+ elif name == 'mwlib': # mwlib 0.14.3 does not include a __init__.py
+ module = __import__(name + '._version',
+ fromlist=['_version'], level=0)
+ if '__version__' in module.__dict__:
+ info['ver'] = module.__version__
+ path = module.__file__
+ path = path[0:path.index('_version.')]
+ info['path'] = path
+
+ # If builtins or standard_lib is None,
+ # only include package if a version was found.
+ if (builtins is None and name in builtin_packages) or \
+ (standard_lib is None and name in std_lib_packages):
+ if 'ver' in info:
+ data[name] = info
+ else:
+ data[name] = info
+
+ # Remove any sub-packages which were loaded with a different name.
+ # e.g. 'wikipedia_family.py' is loaded as 'wikipedia'
+ for path, name in paths.items():
+ for other_path in set(paths) - set([path]):
+ if path.startswith(other_path) and not other_path.startswith(path):
+ del paths[path]
+ del data[name]
+
+ return data
diff --git a/scripts/version.py b/scripts/version.py
index f341332..88b0f62 100755
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -23,3 +23,5 @@
pywikibot.output(u'unicode test: triggers problem #3081100')
else:
pywikibot.output(u'unicode test: ok')
+ import httplib2
+ pywikibot.output('httplib2 version: %s' % httplib2.__version__)
--
To view, visit https://gerrit.wikimedia.org/r/141744
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iae9f73b23ab1eb1a4acce46a690c0b4f9f9396a8
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Betacommand <betacommand(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: jenkins-bot <>