jenkins-bot has submitted this change and it was merged.
Change subject: Adding euskara and sicilianu languages to Vikidia family
......................................................................
Adding euskara and sicilianu languages to Vikidia family
Change-Id: I2f29bc3ed8f265d436e7204adef55a0fa094bb04
---
M pywikibot/families/vikidia_family.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/vikidia_family.py b/pywikibot/families/vikidia_family.py
index 07bbe7a..6acc989 100644
--- a/pywikibot/families/vikidia_family.py
+++ b/pywikibot/families/vikidia_family.py
@@ -17,9 +17,11 @@
'ca': 'ca.vikidia.org',
'en': 'en.vikidia.org',
'es': 'es.vikidia.org',
+ 'eu': 'eu.vikidia.org',
'fr': 'fr.vikidia.org',
'it': 'it.vikidia.org',
'ru': 'ru.vikidia.org',
+ 'scn': 'scn.vikidia.org',
}
def protocol(self, code):
--
To view, visit https://gerrit.wikimedia.org/r/223875
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2f29bc3ed8f265d436e7204adef55a0fa094bb04
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Linedwell <Linedwell(a)icloud.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: pwb fixups for generate_*
......................................................................
pwb fixups for generate_*
1. Do not pass arguments to generate_user_files.
Previously these were silently ignored, however command line
arguments were supported in 2b07db2.
2. Do not force generate_user_files to be run before
generate_family_files
Bug: T74503
Bug: T101838
Change-Id: I241b119fd4f6472c948797c87829d1a3ee09418a
---
M pwb.py
1 file changed, 17 insertions(+), 10 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index 45415c0..9ccb5df 100755
--- a/pwb.py
+++ b/pwb.py
@@ -24,7 +24,6 @@
# [3] https://bitbucket.org/ned/coveragepy/src/2c5fb3a8b81c/setup.py?at=default#c…
import os
-import re
import sys
import types
@@ -165,6 +164,14 @@
del httplib2
+if len(sys.argv) > 1 and sys.argv[1][0] != '-':
+ filename = sys.argv[1]
+else:
+ filename = None
+
+# Skip the filename if one was given
+args = sys.argv[(2 if filename else 1):]
+
# Search for user-config.py before creating one.
try:
# If successful, user-config.py already exists in one of the candidate
@@ -178,20 +185,20 @@
except RuntimeError as err:
# user-config.py to be created
print("NOTE: 'user-config.py' was not found!")
- print("Please follow the prompts to create it:")
- run_python_file('generate_user_files.py',
- ['generate_user_files.py'] + sys.argv[1:],
- [])
- sys.exit(1)
+ if not filename.startswith('generate_'):
+ print("Please follow the prompts to create it:")
+ run_python_file('generate_user_files.py',
+ ['generate_user_files.py'],
+ [])
+ sys.exit(1)
def main():
"""Command line entry point."""
- if len(sys.argv) > 1 and not re.match('-{1,2}help', sys.argv[1]):
+ global filename
+ if filename:
file_package = None
tryimport_pwb()
- filename = sys.argv[1]
- argv = sys.argv[1:]
argvu = pwb.argvu[1:]
if not filename.endswith('.py'):
filename += '.py'
@@ -230,7 +237,7 @@
warn('Parent module %s not found: %s'
% (file_package, e), ImportWarning)
- run_python_file(filename, argv, argvu, file_package)
+ run_python_file(filename, [filename] + args, argvu, file_package)
return True
else:
return False
--
To view, visit https://gerrit.wikimedia.org/r/223874
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I241b119fd4f6472c948797c87829d1a3ee09418a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
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: site.py: update set properly in site.categorymembers()
......................................................................
site.py: update set properly in site.categorymembers()
Update set with proper type (instead of list).
Bug:T103410
Change-Id: I507e0a313a7e4c82b8ccf68d70965693fc6056c3
---
M pywikibot/site.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 86d0c04..1915cde 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3187,7 +3187,7 @@
# TODO: QueryGenerator should detect when the number of
# namespaces requested is higher than available, and split
# the request into several batches.
- excluded_namespaces.add([-1, -2])
+ excluded_namespaces.update([-1, -2])
namespaces = set(self.namespaces) - excluded_namespaces
else:
if 'file' in member_type:
--
To view, visit https://gerrit.wikimedia.org/r/223873
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I507e0a313a7e4c82b8ccf68d70965693fc6056c3
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
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: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: User: check that the '_userprops' attribute exists before deleting it
......................................................................
User: check that the '_userprops' attribute exists before deleting it
Otherwise an AttributeError might be raised if
it hasn't been loaded yet.
Change-Id: I37428175177e4f1b4811b19465a5783ff565d995
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 90efda1..2bf4bd7 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2699,7 +2699,7 @@
@return: dict
"""
- if force:
+ if force and hasattr(self, '_userprops'):
del self._userprops
if not hasattr(self, '_userprops'):
self._userprops = list(self.site.users([self.username, ]))[0]
--
To view, visit https://gerrit.wikimedia.org/r/223871
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I37428175177e4f1b4811b19465a5783ff565d995
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
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: Use mainpage from siteinfo
......................................................................
Use mainpage from siteinfo
Porting a fix from compat to core.
https://mediawiki.org/wiki/Special:Code/pywikipedia/7708
Bug: T103079
Change-Id: Ifd2e3e18860aabe9ecfbd58e3a2a6b33180e1f01
---
M scripts/interwiki.py
1 file changed, 2 insertions(+), 5 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 5f5ffb2..fa26860 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -2539,11 +2539,8 @@
site = pywikibot.Site()
# ensure that we don't try to change main page
- try:
- mainpagename = site.mediawiki_message('mainpage')
- globalvar.skip.add(pywikibot.Page(site, mainpagename))
- except pywikibot.Error:
- pywikibot.output(u'Missing main page name')
+ mainpagename = site.siteinfo['mainpage']
+ globalvar.skip.add(pywikibot.Page(site, mainpagename))
if newPages is not None:
if len(namespaces) == 0:
--
To view, visit https://gerrit.wikimedia.org/r/223870
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd2e3e18860aabe9ecfbd58e3a2a6b33180e1f01
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
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 Win32 config.editor detection
......................................................................
Fix Win32 config.editor detection
Correctly extract the text editor from either .txt or .py
extension registry values.
The winreg.EnumValue invocation was always failing as it used
the wrong parameters.
The extracted text editor command may not work correctly if
it used additional arguments other than "%1". See T102465.
Bug: T70315
Change-Id: I3143bb31ad33b1399ed09fd069b6dae3992926f3
---
M pywikibot/config2.py
M pywikibot/editor.py
2 files changed, 56 insertions(+), 19 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 559a9cf..f9dcab8 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -49,6 +49,12 @@
from warnings import warn
+if sys.platform == 'win32':
+ if sys.version_info[0] > 2:
+ import winreg
+ else:
+ import _winreg as winreg
+
# This frozen set should contain all imported modules/variables, so it must
# occur directly after the imports. At that point globals() only contains the
# names and some magic variables (like __name__)
@@ -420,25 +426,6 @@
# editor will be used.
editor = os.environ.get('EDITOR', None)
# On Windows systems, this script tries to determine the default text editor.
-if sys.platform == 'win32':
- try:
- if sys.version_info[0] > 2:
- import winreg as _winreg
- else:
- import _winreg
- _key1 = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
- 'Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithProgids')
- _progID = _winreg.EnumValue(_key1, 1)[0]
- _key2 = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
- '%s\shell\open\command' % _progID)
- _cmd = _winreg.QueryValueEx(_key2, None)[0]
- _cmd = _cmd.replace('%1', '')
- # Notepad is even worse than our Tkinter editor.
- if not _cmd.lower().endswith('notepad.exe'):
- editor = _cmd
- except WindowsError:
- # Catch any key lookup errors
- pass
# Warning: DO NOT use an editor which doesn't support Unicode to edit pages!
# You will BREAK non-ASCII symbols!
@@ -847,6 +834,51 @@
if path.startswith(base_dir):
return path[len(base_dir) + len(os.path.sep):]
return path
+
+
+def _win32_extension_command(extension):
+ """Get the command from the Win32 registry for an extension."""
+ fileexts_key = r'Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts'
+ key_name = fileexts_key + r'\.' + extension + r'\OpenWithProgids'
+ _winreg = winreg # exists for git blame only; do not use
+ try:
+ key1 = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_name)
+ _progID = winreg.EnumValue(key1, 0)[0]
+ _key2 = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
+ '%s\shell\open\command' % _progID)
+ _cmd = _winreg.QueryValueEx(_key2, None)[0]
+ # See T102465 for issues relating to using this value.
+ cmd = _cmd
+ if cmd.find('%1'):
+ cmd = cmd[:cmd.find('%1')]
+ # Remove any trailing characher, which should be a quote or space
+ # and then remove all whitespace.
+ return cmd[:-1].strip()
+ except WindowsError as e:
+ # Catch any key lookup errors
+ print('WARNING: Unable to find editor for files *.' + extension)
+ print(e)
+
+
+def _detect_win32_editor():
+ """Detect the best Win32 editor."""
+ # Notepad is even worse than our Tkinter editor.
+ unusable_exes = ['notepad.exe',
+ 'py.exe',
+ 'pyw.exe',
+ 'python.exe',
+ 'pythonw.exe']
+
+ for ext in ['py', 'txt']:
+ editor = _win32_extension_command(ext)
+ if editor:
+ for unusable in unusable_exes:
+ if unusable in editor.lower():
+ break
+ else:
+ return editor
+
+
# System-level and User-level changes.
# Store current variables and their types.
_glv = dict((_key, _val) for _key, _val in globals().items()
@@ -956,6 +988,10 @@
elif transliteration_target in ('None', 'none'):
transliteration_target = None
+
+if sys.platform == 'win32' and editor is None:
+ editor = _detect_win32_editor()
+
if sys.platform == 'win32' and editor:
# single character string literals from
# https://docs.python.org/2/reference/lexical_analysis.html#string-literals
diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index 7d0aa1b..f734bda 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -63,6 +63,7 @@
else:
command = []
+ # See T102465 for problems relating to using config.editor unparsed.
command = [config.editor] + command + [file_name]
pywikibot.log(u'Running editor: %s' % TextEditor._concat(command))
return command
--
To view, visit https://gerrit.wikimedia.org/r/223868
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3143bb31ad33b1399ed09fd069b6dae3992926f3
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
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 <>