jenkins-bot has submitted this change and it was merged.
Change subject: core-specific changes
......................................................................
core-specific changes
- use site.code instead of site.lang for L10N
- use Page.title(asUrl=True) instead of Page.urlname()
- update documentation
Change-Id: I05a705934ba23d41b337997ae004bb14c614a12d
---
M scripts/checkimages.py
1 file changed, 6 insertions(+), 11 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index e361c38..d79d3ac 100644
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -335,7 +335,7 @@
'it': u':{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Senza licenza2|%s|__botnick__}} --~~~~',
}
-# You can add some settings to wikipedia. In this way, you can change them
+# You can add some settings to a wiki page. In this way, you can change them
# without touching the code. That's useful if you are running the bot on
# Toolserver.
page_with_settings = {
@@ -613,7 +613,7 @@
self.project = project
bot = config.usernames[project]
try:
- botnick = bot[self.site.lang]
+ botnick = bot[self.site.code]
except KeyError:
raise pywikibot.NoUsername(
u"You have to specify an username for your bot in this project "
@@ -763,8 +763,6 @@
second_text = False
# Getting the talk page's history, to check if there is another
# advise...
- # The try block is used to prevent error if you use an old
- # wikipedia.py's version.
try:
testoattuale = self.talk_page.get()
history = self.talk_page.getLatestEditors(limit=10)
@@ -888,7 +886,6 @@
def returnOlderTime(self, listGiven, timeListGiven):
""" Get some time and return the oldest of them """
- usage = False
num = 0
num_older = None
max_usage = 0
@@ -981,7 +978,7 @@
# project.
return
if re.findall(r'\bstemma\b', self.imageName.lower()) and \
- self.site.lang == 'it':
+ self.site.code == 'it':
pywikibot.output(
u'%s has "stemma" inside, means that it\'s ok.'
% self.imageName)
@@ -1034,7 +1031,7 @@
for duplicate in duplicates:
DupePage = pywikibot.ImagePage(self.site, duplicate)
- if DupePage.urlname() != self.image.urlname() or \
+ if DupePage.title(asUrl=True) != self.image.title(asUrl=True) or \
self.timestamp is None:
self.timestamp = DupePage.getLatestUploader()[1]
data = time.strptime(self.timestamp, u"%Y-%m-%dT%H:%M:%SZ")
@@ -1115,7 +1112,6 @@
if len(images_to_tag_list) != 0 and not only_report:
already_reported_in_past = self.countEdits(
u'File:%s' % images_to_tag_list[-1], self.botolist)
- image_to_resub = images_to_tag_list[-1]
from_regex = r'\n\*\[\[:File:%s\]\]' \
% re.escape(self.convert_to_url(
self.imageName))
@@ -1299,7 +1295,7 @@
pywikibot.output(u'\nLoading the allowed licenses...\n')
cat = pywikibot.Category(self.site, catName)
list_licenses = list(cat.articles())
- if self.site.lang == 'commons':
+ if self.site.code == 'commons':
no_licenses_to_skip = pywikibot.Category(self.site,
'License-related tags')
for license_given in no_licenses_to_skip.articles():
@@ -1488,7 +1484,6 @@
def load(self, raw):
""" Load a list of objects from a string using regex. """
list_loaded = []
- pos = 0
# I search with a regex how many user have not the talk page
# and i put them in a list (i find it more easy and secure)
regl = r"(\"|\')(.*?)\1(?:,|\])"
@@ -1898,7 +1893,7 @@
# A little block-statement to ensure that the bot will not start with
# en-parameters
- if site.lang not in project_inserted:
+ if site.code not in project_inserted:
pywikibot.output(u"Your project is not supported by this script.\n"
u"You have to edit the script and add it!")
return
--
To view, visit https://gerrit.wikimedia.org/r/142877
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I05a705934ba23d41b337997ae004bb14c614a12d
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.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: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: (bug 66951) Fix getversion_nightly and check for IOError
......................................................................
(bug 66951) Fix getversion_nightly and check for IOError
- unnotified IOError caused that bug and general exceptions hides
the right reason of it.
- the version file's information sequence might be change,
reorder retrieving it.
- online parsing may be omitted
- synchronize some parts with core
Change-Id: Iec2a89f12b0c571c63b1b7c76d206b9b47d33f4f
---
M pywikibot/version.py
1 file changed, 35 insertions(+), 17 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/version.py b/pywikibot/version.py
index c4c8f54..9838fcd 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-""" Module to determine the pywikipedia version (tag, revision and date) """
+""" Module to determine the pywikibot version (tag, revision and date) """
#
# (C) Merlijn 'valhallasw' van Deen, 2007-2014
# (C) xqt, 2010-2014
-# (C) Pywikipedia bot team, 2007-2013
+# (C) Pywikibot team, 2007-2013
#
# Distributed under the terms of the MIT license.
#
@@ -20,7 +20,8 @@
class ParseError(Exception):
- """ Parsing went wrong """
+
+ """ Parsing went wrong. """
def _get_program_dir():
@@ -28,14 +29,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 ParseError:
+ 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
@@ -109,7 +117,7 @@
_program_dir = path or _get_program_dir()
entries = open(os.path.join(_program_dir, '.svn/entries'))
version = entries.readline().strip()
- #use sqlite table for new entries format
+ # use sqlite table for new entries format
if version == "12":
entries.close()
from sqlite3 import dbapi2 as sqlite
@@ -125,13 +133,13 @@
tag = os.path.split(tag)[1]
date = time.gmtime(date / 1000000)
else:
- for i in xrange(3):
+ for i in range(3):
entries.readline()
tag = entries.readline().strip()
t = tag.split('://')
t[1] = t[1].replace('svn.wikimedia.org/svnroot/pywikipedia/', '')
tag = '[%s] %s' % (t[0], t[1])
- for i in xrange(4):
+ for i in range(4):
entries.readline()
date = time.strptime(entries.readline()[:19], '%Y-%m-%dT%H:%M:%S')
rev = entries.readline()[:-1]
@@ -199,17 +207,27 @@
def getversion_nightly():
- data = open(os.path.join(wikipediatools.get_base_dir(), 'version'))
+ import wikipediatools
+ try:
+ data = open(os.path.join(wikipediatools.get_base_dir(), 'version'))
+ except IOError:
+ raise ParseError
tag = data.readline().strip()
- date = time.strptime(data.readline()[:19], '%Y-%m-%dT%H:%M:%S')
rev = data.readline().strip()
+ date = time.strptime(data.readline()[:19], '%Y-%m-%dT%H:%M:%S')
+ hsh = data.readline().strip()
+
if not date or not tag or not rev:
raise ParseError
- return (tag, rev, date, '(unknown)')
+ return (tag, rev, date, hsh)
def getversion_onlinerepo(repo=None):
- """ Retrieve revision number of framework online repository's svnroot """
+ """Retrieve current framework revision number from online repository.
+
+ @param repo: (optional) Online repository location
+ @type repo: URL or string
+ """
url = repo or 'https://git.wikimedia.org/feed/pywikibot/compat'
hsh = None
try:
--
To view, visit https://gerrit.wikimedia.org/r/142215
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iec2a89f12b0c571c63b1b7c76d206b9b47d33f4f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: DrTrigon <dr.trigon(a)surfeu.ch>
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 <>
jenkins-bot has submitted this change and it was merged.
Change subject: update mw releases
......................................................................
update mw releases
Change-Id: I310a4238ba7faeb13441c79a71fb627526fe8cb2
---
M family.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/family.py b/family.py
index 5ca855c..d3e4b16 100644
--- a/family.py
+++ b/family.py
@@ -4326,7 +4326,7 @@
# Don't use this, use versionnumber() instead. This only exists
# to not break family files.
# Here we return the latest mw release for downloading
- return '1.23.0'
+ return '1.23.1'
def versionnumber(self, code, version=None):
"""Return an int identifying MediaWiki version.
@@ -4962,7 +4962,7 @@
# Don't use this, use versionnumber() instead. This only exists
# to not break family files.
# Here we return the latest mw release of wikimedia projects
- return '1.24wmf7'
+ return '1.24wmf10'
def shared_image_repository(self, code):
return ('commons', 'commons')
--
To view, visit https://gerrit.wikimedia.org/r/143898
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I310a4238ba7faeb13441c79a71fb627526fe8cb2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>