Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #2165
Status: Failed
Duration: 53 minutes and 49 seconds
Commit: de17276 (master)
Author: Fabian Neundorf
Message: [FIX] welcome: Fallback for i18n translate
Reimplement 65518573d2b07c7b807fd890b0e18613e885ecbe after that has been
reverted in 7e401c34621d0a2ae76d8a896ab93d8984df13d6 because it
introduced T97291.
Bug: T95921
Change-Id: I04694f179a3b58058d01c9b71a53862f97f91bf9
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/7e401c34621d...de17276d…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/60297157
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: Mark checkimages as an autorun script
......................................................................
Mark checkimages as an autorun script
Once it gets past any errors, this script does commence acting
without any further arguments.
Bug: T70613
Change-Id: Ic55cd1a398ca660db4e9de927eb5afcec6b70be1
---
M tests/script_tests.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/script_tests.py b/tests/script_tests.py
index dd44df3..d8511ff 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -100,6 +100,7 @@
'catall',
'category_redirect',
'cfd',
+ 'checkimages',
'clean_sandbox',
'disambredir',
'imagerecat',
@@ -333,12 +334,12 @@
dct[test_name] = test_execution(script_name, ['-simulate'],
no_args_expected_results)
if script_name in ['catall', # stdout user interaction
- 'checkimages', # bug 68613
'flickrripper', # Requires a flickr api key
'script_wui', # Error on any user except DrTrigonBot
'upload', # raises custom ValueError
] + failed_dep_script_list or (
(config.family == 'wikipedia' and script_name == 'disambredir') or
+ (config.family != 'wikidata' and script_name == 'checkimages') or
(config.family == 'wikipedia' and config.mylang != 'en' and script_name == 'misspelling')): # T94681
dct[test_name] = unittest.expectedFailure(dct[test_name])
elif script_name in ['watchlist', # T77965
--
To view, visit https://gerrit.wikimedia.org/r/203258
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic55cd1a398ca660db4e9de927eb5afcec6b70be1
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] welcome: Fallback for i18n translate
......................................................................
[FIX] welcome: Fallback for i18n translate
Reimplement 65518573d2b07c7b807fd890b0e18613e885ecbe after that has been
reverted in 7e401c34621d0a2ae76d8a896ab93d8984df13d6 because it
introduced T97291.
Bug: T95921
Change-Id: I04694f179a3b58058d01c9b71a53862f97f91bf9
---
M pywikibot/i18n.py
M scripts/welcome.py
2 files changed, 29 insertions(+), 15 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
Xqt: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 2fff519..77e57c6 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -365,6 +365,9 @@
return message
+DEFAULT_FALLBACK = ('_default', )
+
+
def translate(code, xdict, parameters=None, fallback=False):
"""Return the most appropriate translation from a translation dict.
@@ -375,8 +378,9 @@
The language itself is always checked first, then languages that
have been defined to be alternatives, and finally English. If none of
- the options gives result, we just take the first language in the
- list.
+ the options gives result, we just take the one language from xdict which may
+ not be always the same. When fallback is iterable it'll return None if no
+ code applies (instead of returning one).
For PLURAL support have a look at the twntranslate method
@@ -389,9 +393,9 @@
@type xdict: dict, string, unicode
@param parameters: For passing (plural) parameters
@type parameters: dict, string, unicode, int
- @param fallback: Try an alternate language code
- @type fallback: boolean
-
+ @param fallback: Try an alternate language code. If it's iterable it'll
+ also try those entries and choose the first match.
+ @type fallback: boolean or iterable
"""
family = pywikibot.config.family
# If a site is given instead of a code, use its language
@@ -407,20 +411,29 @@
xdict = xdict['wikipedia']
# Get the translated string
- trans = None
if not isinstance(xdict, dict):
trans = xdict
- elif code in xdict:
- trans = xdict[code]
- elif fallback:
- for alt in _altlang(code) + ['_default', 'en']:
- if alt in xdict:
- trans = xdict[alt]
- code = alt
+ elif not xdict:
+ trans = None
+ else:
+ codes = [code]
+ if fallback is True:
+ codes += _altlang(code) + ['_default', 'en']
+ elif fallback is not False:
+ codes += list(fallback)
+ for code in codes:
+ if code in xdict:
+ trans = xdict[code]
break
else:
- trans = list(xdict.values())[0]
+ if fallback is not True:
+ # this shouldn't simply return "any one" code but when fallback
+ # was True before 65518573d2b0, it did just that. When False it
+ # did just return None. It's now also returning None in the new
+ # iterable mode.
+ return
code = list(xdict.keys())[0]
+ trans = xdict[code]
if trans is None:
return # return None if we have no translation found
if parameters is None:
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 65d0e67..cefbf93 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -658,7 +658,8 @@
showStatus()
pywikibot.output(
'Log page is not exist, getting information for page creation')
- text = i18n.translate(self.site, logpage_header)
+ text = i18n.translate(self.site, logpage_header,
+ fallback=i18n.DEFAULT_FALLBACK)
text += u'\n!%s' % self.site.namespace(2)
text += u'\n!%s' % str.capitalize(
self.site.mediawiki_message('contribslink'))
--
To view, visit https://gerrit.wikimedia.org/r/206812
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I04694f179a3b58058d01c9b71a53862f97f91bf9
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: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Revert "[FIX] welcome: Fallback for i18n translate"
......................................................................
Revert "[FIX] welcome: Fallback for i18n translate"
revert due to bug T79291
This reverts commit 65518573d2b07c7b807fd890b0e18613e885ecbe.
Change-Id: I0e8a1f3a2b27a3af6e473a021df84d41779fad02
---
M pywikibot/i18n.py
M scripts/welcome.py
2 files changed, 15 insertions(+), 28 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 06c4049..2fff519 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -365,9 +365,6 @@
return message
-DEFAULT_FALLBACK = ('_default', )
-
-
def translate(code, xdict, parameters=None, fallback=False):
"""Return the most appropriate translation from a translation dict.
@@ -378,9 +375,8 @@
The language itself is always checked first, then languages that
have been defined to be alternatives, and finally English. If none of
- the options gives result, we just take the one language from xdict which may
- not be always the same. When fallback is iterable it'll return None if no
- code applies (instead of returning one).
+ the options gives result, we just take the first language in the
+ list.
For PLURAL support have a look at the twntranslate method
@@ -393,9 +389,9 @@
@type xdict: dict, string, unicode
@param parameters: For passing (plural) parameters
@type parameters: dict, string, unicode, int
- @param fallback: Try an alternate language code. If it's iterable it'll
- also try those entries and choose the first match.
- @type fallback: boolean or iterable
+ @param fallback: Try an alternate language code
+ @type fallback: boolean
+
"""
family = pywikibot.config.family
# If a site is given instead of a code, use its language
@@ -411,28 +407,20 @@
xdict = xdict['wikipedia']
# Get the translated string
+ trans = None
if not isinstance(xdict, dict):
trans = xdict
- elif not xdict:
- trans = None
- else:
- codes = [code]
- if fallback is True:
- codes += _altlang(code) + ['_default', 'en']
- elif fallback is not False:
- codes += list(fallback)
- for code in codes:
- if code in xdict:
- trans = xdict[code]
+ elif code in xdict:
+ trans = xdict[code]
+ elif fallback:
+ for alt in _altlang(code) + ['_default', 'en']:
+ if alt in xdict:
+ trans = xdict[alt]
+ code = alt
break
else:
- if fallback is not False and fallback is not True:
- # future versions shouldn't simply return "any one" code but
- # no translation as this is not very deterministic. When
- # fallback is iterable it's a new mode previously not supported
- return
+ trans = list(xdict.values())[0]
code = list(xdict.keys())[0]
- trans = xdict[code]
if trans is None:
return # return None if we have no translation found
if parameters is None:
diff --git a/scripts/welcome.py b/scripts/welcome.py
index cefbf93..65d0e67 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -658,8 +658,7 @@
showStatus()
pywikibot.output(
'Log page is not exist, getting information for page creation')
- text = i18n.translate(self.site, logpage_header,
- fallback=i18n.DEFAULT_FALLBACK)
+ text = i18n.translate(self.site, logpage_header)
text += u'\n!%s' % self.site.namespace(2)
text += u'\n!%s' % str.capitalize(
self.site.mediawiki_message('contribslink'))
--
To view, visit https://gerrit.wikimedia.org/r/206811
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e8a1f3a2b27a3af6e473a021df84d41779fad02
Gerrit-PatchSet: 1
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: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Only run travis build on prod sites
......................................................................
Only run travis build on prod sites
Temporary workaround for bug on test sites.
Bug: T96943
Change-Id: I5604a389016c155ed31fad6a138061a81732426e
---
M .travis.yml
M tests/aspects.py
2 files changed, 11 insertions(+), 4 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index fa77aae..2077d2b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -79,9 +79,9 @@
# See http://docs.travis-ci.com/user/encryption-keys/ for more information.
- secure: kofInMlisiTBt9o/Ustc/vySlkKfxGzGCX2LwA1D2waym8sDTS0o5gMJ5LsrT/BUKwZbe1vLozPHqZrrkQvsdTml+DpZuotzdILs0m0f3BUoexEC6OON5IDljuxFyETrD1Ug44ih5Mc4lVFOdTcBzg501ZmswGwQrBvg/OyEFfE=
matrix:
- - LANGUAGE=en FAMILY=wikipedia EXTERNALS_HTTPLIB2=1
- - LANGUAGE=fr FAMILY=wikipedia PYSETUP_TEST_EXTRAS=1
- - LANGUAGE=test FAMILY=wikidata SITE_ONLY=1
+ - LANGUAGE=en FAMILY=wikipedia EXTERNALS_HTTPLIB2=1 PYWIKIBOT2_TEST_PROD_ONLY=1
+ - LANGUAGE=fr FAMILY=wikipedia PYSETUP_TEST_EXTRAS=1 PYWIKIBOT2_TEST_PROD_ONLY=1
+ - LANGUAGE=wikidata FAMILY=wikidata SITE_ONLY=1
- LANGUAGE=ar FAMILY=wiktionary SITE_ONLY=1 EXTERNALS_HTTPLIB2=1
notifications:
diff --git a/tests/aspects.py b/tests/aspects.py
index 7120fde..0af24b4 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -823,10 +823,17 @@
pywikibot._sites = {}
interface = None # defaults to 'APISite'
- if hasattr(cls, 'dry') and cls.dry:
+ dry = hasattr(cls, 'dry') and cls.dry
+ if dry:
interface = DrySite
for data in cls.sites.values():
+ if ('code' in data and data['code'] in ('test', 'mediawiki') and
+ 'PYWIKIBOT2_TEST_PROD_ONLY' in os.environ and not dry):
+ raise unittest.SkipTest(
+ 'Site code "%s" and PYWIKIBOT2_TEST_PROD_ONLY is set.'
+ % data['code'])
+
if 'site' not in data and 'code' in data and 'family' in data:
data['site'] = Site(data['code'], data['family'],
interface=interface)
--
To view, visit https://gerrit.wikimedia.org/r/206076
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5604a389016c155ed31fad6a138061a81732426e
Gerrit-PatchSet: 3
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>