jenkins-bot has submitted this change and it was merged.
Change subject: Update main copyright year to 2016
......................................................................
Update main copyright year to 2016
Change-Id: I577c931e24c1a3de4c87ee59ef958a5f62f97ce9
(cherry-picked from commit 3f2b0468dc)
---
M LICENSE
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/LICENSE b/LICENSE
index 71d9a57..51e9f85 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2015 Pywikibot team
+Copyright (c) 2004-2016 Pywikibot team
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
--
To view, visit https://gerrit.wikimedia.org/r/263347
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4a1e98f0581a5c9adfe66ece9aeea2f23d052d9
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Backport changelog to master
......................................................................
Backport changelog to master
Change-Id: I4bf919561f11b7109712bf106875ae58530d0cc8
---
M ChangeLog
1 file changed, 95 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ChangeLog b/ChangeLog
index 0af0188..17a191d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,100 @@
+Release 2.0rc4 (15 December 2015)
+=================================
+
+Bugfixes (core)
+---------------
+e42891d Remove dependency on pYsearch
+ecc39ce Require google>=0.7
+fa431a4 Desupport Python 2.6 for Pywikibot 2.0 release branch
+b1f6f39 config: Don't crash on later get_base_dir calls
+0925c51 cosmetic_changes: merge similar regexes
+4bf39f3 Update revId upon claim change
+ea11626 Update WOW hostnames
+2a5a4fa Mark site.patrol() as a user write action
+4f568c5 Fix interwikiFormat support for Link
+7cb6962 Changes are wrongly detected in the last langlink
+5c5d658 getLanguageLinks: Skip own site
+7ee8ec2 fix intersection of sets of namespaces
+94b0c43 Import textlib.TimeStripper
+584d7c1 Change "PyWikiBot" to "Pywikibot"
+1f8d57e Stop crashing item loads due to support of units
+c19dcfa __all__ items must be bytes on Python 2
+e6aa6ca Omit includeredirects parameter for allpages generator
+687ec9e Performance fix for sites using interwiki_putfirst option
+28db3d2 Fix Persian Wikipedia configuration
+3944f5e rollback: Use Revision instance properly
+860af34 Add must_be to DataSite write actions
+f8af8e0 Remove unneeded site argument to AutoFamily
+bf49a7d Fix ComparableMixin
+1d36e45 Deprecate ParamInfo.query_modules_with_limits
+e83c6a3 be-x-old is renamed to be-tarask
+19bbe7e Correctly identify qualifier from JSON
+
+Bugfixes (scripts)
+------------------
+4e78c27 checkimages: Expect NoPage exception
+fbb6266 interwiki: Optimize/remove unneeded calls to Page.isEmpty()
+428420a interwiki: Allow Subject.originPage to be updated
+a305d7b interwiki: Allow titletranslate.translate page to be None
+a786226 interwiki: '-ignore' parameter throws exception
+ab7abf5 interwiki: check for category before emptiness
+0db2e87 interwiki: do not automatically log in
+47ed5d5 nowcommons: Query at most one users
+
+Release 2.0rc3 (30 September 2015)
+==================================
+
+Bugfixes (core)
+---------------
+6406479 New Wikipedia site: azb
+b503a1e Indexes in str.format
+d1854f5 MediaWikiVersion: Accept new wmf style
+718e4a1 i18n: always follow master
+
+Release 2.0rc2 (9 July 2015)
+============================
+
+Bugfixes (scripts)
+------------------
+8d76870 replace.py: remove line endings when reading from file
+bfe60b0 archive.py: Don't ignore "DoNotArchiveUntil" timestamps
+0df272b redirect.py: Don't break the script for hidden pages.
+9806a7a upload.py: allow all formats allowed by commons
+1dcbfd8, 0592360 replace.py: fix handling of addedCat
+
+Small new features (scripts)
+----------------------------
+a47c0d7 clean_sandbox.py: Use pagegenerators
+288b9ce replace.py: Inform about missing user-fixes.py
+
+Configuration updates
+---------------------
+d721249 Changing the sandbox content template on Fa WP
+
+Family file updates
+-------------------
+21d6a8d Remove broken wikis from battlestarwiki family
+3c2bcc5 Adding euskara and sicilianu languages to Vikidia family
+a3a3d53 WOW Wiki subdomains hr, ro & sr deleted
+474c786 Add new Wikipedia languages gom and lrc
+
+Bugfixes (core)
+---------------
+c7a12b5 fix UnicodeDecodeError on api error
+ea00683 pwb.py now correctly passes arguments to generate_family_file
+3685a24 Fix Win32 config.editor detection
+3333251 open_compressed: Wrap BZ2File in Py 2.7
+f2309e5 Skip RC entries without a title
+ab9fdfb PatrolEntry: Allow cur/prev id to be str
+156bdd0, 0b6fda9 Updates to i18n changes
+49fc65f Do not use ParamInfo during action=login
+796f273 Let pydot encode labels for Python 3 support
+3488a4b Fix and test interwiki_graph
+ba6b671 textlib: replaceExcept: Handle empty matches
+
Release 2.0rc1 (25 May 2015)
-
+============================
Major improvements include:
- Sphinx documentation at https://doc.wikimedia.org/pywikibot/
- Initial ProofreadPage support
--
To view, visit https://gerrit.wikimedia.org/r/263332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4bf919561f11b7109712bf106875ae58530d0cc8
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Revert "New textlib.replace_links() link replacements"
......................................................................
[bugfix] Revert "New textlib.replace_links() link replacements"
- unbreak the bot which creates missleading links when the source or
target is a section link.
- ignore target section if it does not exist
- restore the same script behaviour like in compat
This reverts commit 18e6c9b1e655a807ce0ab732880c9874093cef1b
for fixing_redirects.py
Bug: T68403
Change-Id: If9226cf514dff2b6e26f4227f537dc7690d1aec2
---
M scripts/fixing_redirects.py
1 file changed, 92 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index 9273772..fe02548 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -13,7 +13,7 @@
"""
#
-# (C) Pywikibot team, 2004-2015
+# (C) Pywikibot team, 2004-2016
#
# Distributed under the terms of the MIT license.
#
@@ -21,11 +21,15 @@
__version__ = '$Id$'
#
+import re
+
import pywikibot
from pywikibot import pagegenerators
from pywikibot.bot import (SingleSiteBot, ExistingPageBot, NoRedirectPageBot,
AutomaticTWSummaryBot, suggest_help)
+from pywikibot.textlib import does_text_contain_section
from pywikibot.tools.formatter import color_format
+from pywikibot.tools import first_lower, first_upper as firstcap
# This is required for the text that is shown when you run this script
# with the parameter -help.
@@ -46,6 +50,83 @@
ignore_server_errors = True
summary_key = 'fixing_redirects-fixing'
+ def replace_links(self, text, linkedPage, targetPage):
+ """Replace all source links by target."""
+ mysite = pywikibot.Site()
+ linktrail = mysite.linktrail()
+
+ # make a backup of the original text so we can show the changes later
+ linkR = re.compile(r'\[\[(?P<title>[^\]\|#]*)(?P<section>#[^\]\|]*)?'
+ r'(\|(?P<label>[^\]]*))?\]\](?P<linktrail>' + linktrail + ')')
+ curpos = 0
+ # This loop will run until we have finished the current page
+ while True:
+ m = linkR.search(text, pos=curpos)
+ if not m:
+ break
+ # Make sure that next time around we will not find this same hit.
+ curpos = m.start() + 1
+ # ignore interwiki links and links to sections of the same page
+ if m.group('title').strip() == '' or \
+ mysite.isInterwikiLink(m.group('title')):
+ continue
+ else:
+ actualLinkPage = pywikibot.Page(targetPage.site, m.group('title'))
+ # Check whether the link found is to page.
+ if actualLinkPage != linkedPage:
+ continue
+
+ # The link looks like this:
+ # [[page_title|link_text]]trailing_chars
+ page_title = m.group('title')
+ link_text = m.group('label')
+
+ if not link_text:
+ # or like this: [[page_title]]trailing_chars
+ link_text = page_title
+ if m.group('section') is None:
+ section = ''
+ else:
+ section = m.group('section')
+ if section and targetPage.section():
+ pywikibot.warning(
+ 'Source section {0} and target section {1} found. '
+ 'Skipping.'.format(section, targetPage))
+ continue
+ trailing_chars = m.group('linktrail')
+ if trailing_chars:
+ link_text += trailing_chars
+
+ # remove preleading ":"
+ if link_text[0] == ':':
+ link_text = link_text[1:]
+ if link_text[0].isupper() or link_text[0].isdigit():
+ new_page_title = targetPage.title()
+ else:
+ new_page_title = first_lower(targetPage.title())
+
+ # remove preleading ":"
+ if new_page_title[0] == ':':
+ new_page_title = new_page_title[1:]
+
+ if (new_page_title == link_text and not section):
+ newlink = "[[%s]]" % new_page_title
+ # check if we can create a link with trailing characters instead of a
+ # pipelink
+ elif (len(new_page_title) <= len(link_text) and
+ firstcap(link_text[:len(new_page_title)]) ==
+ firstcap(new_page_title) and
+ re.sub(re.compile(linktrail), '',
+ link_text[len(new_page_title):]) == '' and
+ not section):
+ newlink = "[[%s]]%s" % (link_text[:len(new_page_title)],
+ link_text[len(new_page_title):])
+ else:
+ newlink = "[[%s%s|%s]]" % (new_page_title, section, link_text)
+ text = text[:m.start()] + newlink + text[m.end():]
+ continue
+ return text
+
def treat_page(self):
"""Change all redirects from the current page to actual links."""
links = self.current_page.linkedPages()
@@ -65,12 +146,21 @@
except (pywikibot.CircularRedirect,
pywikibot.InvalidTitle):
continue
+ else:
+ section = target.section()
+ if section and not does_text_contain_section(target.text,
+ section):
+ pywikibot.warning(
+ 'Section #{0} not found on page {1}'.format(
+ section, target.title(asLink=True,
+ withSection=False)))
+ continue
else:
continue
# no fix to user namespaces
if target.namespace() in [2, 3] and page.namespace() not in [2, 3]:
continue
- newtext = pywikibot.textlib.replace_links(newtext, [page, target])
+ newtext = self.replace_links(newtext, page, target)
if i is None:
pywikibot.output('Nothing left to do.')
--
To view, visit https://gerrit.wikimedia.org/r/255933
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If9226cf514dff2b6e26f4227f537dc7690d1aec2
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Remove Wikipedia special cases from interwiki.py
......................................................................
Remove Wikipedia special cases from interwiki.py
Wikipedia now uses Wikidata for interwiki links,
so any special cases in interwiki.py for Wikipedia
are unused code.
Change-Id: I41d2b254ce265c4f44e0ad7e72790f5dc52b0014
---
M scripts/interwiki.py
1 file changed, 2 insertions(+), 64 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 8887c5b..7b500ca 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -145,8 +145,7 @@
* scand: All Scandinavian languages.
Names of families that forward their interlanguage links
- to the wiki family being worked upon can be used (with
- -family=wikipedia only), they are:
+ to the wiki family being worked upon can be used, they are:
* commons: Interlanguage links of Mediawiki Commons.
* incubator: Links in pages on the Mediawiki Incubator.
* meta: Interlanguage links of named pages on Meta.
@@ -348,7 +347,6 @@
#
import codecs
-import datetime
import os
import pickle
import re
@@ -1723,65 +1721,9 @@
break
else:
for (site, page) in new.items():
- # edit restriction for some templates on zh-wiki where
- # interlanguage keys are included by /doc subpage
- smallWikiAllowed = not (page.site.sitename == 'wikipedia:zh' and
- page.namespace() == 10 and
- u'Country data' in page.title(withNamespace=False))
- # edit restriction on is-wiki
- # https://is.wikipedia.org/wiki/Wikipediaspjall:V%C3%A9lmenni
- # and zh-wiki for template namespace which prevents increasing the queue
- # allow edits for the same conditions as -whenneeded
- # or the last edit wasn't a bot
- # or the last edit was 1 month ago
- if (smallWikiAllowed and
- globalvar.autonomous and
- (page.site.sitename == 'wikipedia:is' or
- page.site.sitename == 'wikipedia:zh' and
- page.namespace() == 10
- )):
- old = {}
- try:
- for mypage in new[page.site].interwiki():
- old[mypage.site] = mypage
- except pywikibot.NoPage:
- pywikibot.output(u"BUG>>> %s no longer exists?"
- % new[site])
- continue
- mods, mcomment, adding, removing, modifying \
- = compareLanguages(old, new, insite=site)
- # cannot create pywikibot.User with IP
- smallWikiAllowed = (
- page.isIpEdit() or
- len(removing) > 0 or
- len(old) == 0 or
- len(adding) + len(modifying) > 2 or
- (
- len(removing) + len(modifying) == 0 and
- adding == [page.site]
- )
- )
- if not smallWikiAllowed:
- user = pywikibot.User(page.site, page.userName())
- # erstmal auch keine namen mit bot
- if 'bot' not in user.groups() \
- and 'bot' not in page.userName().lower():
- smallWikiAllowed = True
- else:
- _now = datetime.datetime.utcnow()
- _editTime = page.editTime()
- if abs((_now - _editTime).days) > 30:
- smallWikiAllowed = True
- else:
- pywikibot.output(
- u'NOTE: number of edits are restricted at %s'
- % page.site.sitename
- )
-
# if we have an account for this site
if site.family.name in config.usernames and \
site.code in config.usernames[site.family.name] and \
- smallWikiAllowed and \
not site.has_transcluded_data:
# Try to do the changes
try:
@@ -1915,11 +1857,7 @@
# put it to new means don't delete it
if (
not globalvar.cleanup or
- unicode(rmPage) not in globalvar.remove or
- (
- rmPage.site.sitename() == 'wikipedia:hi' and
- page.site.sitename() != 'wikipedia:de' # work-arround for bug #3081100 (do not remove hi-pages)
- )
+ unicode(rmPage) not in globalvar.remove
):
new[rmsite] = rmPage
pywikibot.output(
--
To view, visit https://gerrit.wikimedia.org/r/263223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I41d2b254ce265c4f44e0ad7e72790f5dc52b0014
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>