jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Diff: Support Python < 2.7.2
......................................................................
[FIX] Diff: Support Python < 2.7.2
The function named '_format_range_unified' was introduced in 2.7.2:
https://hg.python.org/cpython/file/8527427914a2/Lib/difflib.py#l1147
This adds a backported version of so that Python 2.6, 2.7.0 and 2.7.1
are supported
It also fixes a problem with non-indexed placeholders for format which
aren't supported in Python 2.6.
Bug: T76276
Change-Id: I2f2799f434d3a0782999f94a307c9a081a004014
---
A pywikibot/backports.py
M pywikibot/diff.py
2 files changed, 83 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/backports.py b/pywikibot/backports.py
new file mode 100644
index 0000000..55712da
--- /dev/null
+++ b/pywikibot/backports.py
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+"""
+This module contains backports to support older Python versions.
+
+They contain the backported code originally developed for Python. It is
+therefore distributed under the PSF license, as follows:
+
+PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+--------------------------------------------
+1. This LICENSE AGREEMENT is between the Python Software Foundation
+("PSF"), and the Individual or Organization ("Licensee") accessing and
+otherwise using this software ("Python") in source or binary form and
+its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF hereby
+grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
+analyze, test, perform and/or display publicly, prepare derivative works,
+distribute, and otherwise use Python alone or in any derivative version,
+provided, however, that PSF's License Agreement and PSF's notice of copyright,
+i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+2011, 2012, 2013, 2014 Python Software Foundation; All Rights Reserved" are
+retained in Python alone or in any derivative version prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python.
+
+4. PSF is making Python available to Licensee on an "AS IS"
+basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between PSF and
+Licensee. This License Agreement does not grant permission to use PSF
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+"""
+#
+# (C) Python Software Foundation, 2001-2014
+# (C) with modifications from Pywikibot team, 2014
+#
+# Distributed under the terms of the PSF license.
+#
+
+
+def format_range_unified(start, stop):
+ """
+ Convert range to the "ed" format.
+
+ Copied from C{difflib._format_range_unified()} which was introduced in
+ Python 2.7.2.
+
+ @see: https://hg.python.org/cpython/file/8527427914a2/Lib/difflib.py#l1147
+ """
+ # Per the diff spec at http://www.unix.org/single_unix_specification/
+ beginning = start + 1 # lines start numbering with one
+ length = stop - start
+ if length == 1:
+ return '{0}'.format(beginning)
+ if not length:
+ beginning -= 1 # empty ranges begin at line just before the range
+ return '{0},{1}'.format(beginning, length)
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 7773b7e..a93a90b 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -16,6 +16,7 @@
from itertools import izip_longest as zip_longest
import pywikibot
+from pywikibot.backports import format_range_unified # introduced in 2.7.2
class Hunk(object):
@@ -65,9 +66,9 @@
def get_header(self):
"""Provide header of unified diff."""
- a_rng = difflib._format_range_unified(*self.a_rng)
- b_rng = difflib._format_range_unified(*self.b_rng)
- return '@@ -{} +{} @@{}'.format(a_rng, b_rng, '\n')
+ a_rng = format_range_unified(*self.a_rng)
+ b_rng = format_range_unified(*self.b_rng)
+ return '@@ -{0} +{1} @@\n'.format(a_rng, b_rng)
def create_diff(self):
"""Generator of diff text for this hunk, without formatting."""
--
To view, visit https://gerrit.wikimedia.org/r/176499
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2f2799f434d3a0782999f94a307c9a081a004014
Gerrit-PatchSet: 6
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1745
Status: Errored
Duration: 48 minutes and 14 seconds
Commit: 2a02501 (master)
Author: Fabian Neundorf
Message: [FIX] Weblinkchecker: Report malformed URLs (port)
Don't throw URL exception in the checker thread if the URL cannot be
parsed.
Introduce NotAnURLError exception to allow information about malformed
URLs to be passed to the reporting facility.
This is ported from 405b73862c2859f816dcfe0313c46bde760f82f3 in compat.
Bug: T76294
Change-Id: I0474ddad3b19faed598cf14c647e3c62e9270f50
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/b7a8cd0bd094...2a02501d…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/42554498
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1744
Status: Fixed
Duration: 47 minutes and 24 seconds
Commit: b7a8cd0 (master)
Author: John Vandenberg
Message: Fix timestamp tests if month changes
On the last and first day of a month, simply adding a day or subtracting
a day will cause the day to go out of bounds. So if the month changes,
it's probably the last or first day of a month.
Bug: T76285
Change-Id: Ibeb12f4f911c0bc9d40a92ca718464a90082f428
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/13023ab02b3f...b7a8cd0b…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/42554206
--
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: Fix timestamp tests if month changes
......................................................................
Fix timestamp tests if month changes
On the last and first day of a month, simply adding a day or subtracting
a day will cause the day to go out of bounds. So if the month changes,
it's probably the last or first day of a month.
Bug: T76285
Change-Id: Ibeb12f4f911c0bc9d40a92ca718464a90082f428
---
M tests/timestamp_tests.py
1 file changed, 9 insertions(+), 2 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/timestamp_tests.py b/tests/timestamp_tests.py
index c3e0c2b..a2dd8b8 100644
--- a/tests/timestamp_tests.py
+++ b/tests/timestamp_tests.py
@@ -7,6 +7,7 @@
#
__version__ = '$Id$'
+import calendar
import datetime
from pywikibot import Timestamp as T
@@ -55,7 +56,10 @@
def test_add_timedelta(self):
t1 = T.utcnow()
t2 = t1 + datetime.timedelta(days=1)
- self.assertEqual(t1.day + 1, t2.day)
+ if t1.month != t2.month:
+ self.assertEqual(1, t2.day)
+ else:
+ self.assertEqual(t1.day + 1, t2.day)
self.assertIsInstance(t2, T)
def test_add_timedate(self):
@@ -74,7 +78,10 @@
def test_sub_timedelta(self):
t1 = T.utcnow()
t2 = t1 - datetime.timedelta(days=1)
- self.assertEqual(t1.day - 1, t2.day)
+ if t1.month != t2.month:
+ self.assertEqual(calendar.monthrange(t2.year, t2.month)[1], t2.day)
+ else:
+ self.assertEqual(t1.day - 1, t2.day)
self.assertIsInstance(t2, T)
def test_sub_timedate(self):
--
To view, visit https://gerrit.wikimedia.org/r/176501
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibeb12f4f911c0bc9d40a92ca718464a90082f428
Gerrit-PatchSet: 3
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: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: scripts.catall: Make script documentation more clear
......................................................................
scripts.catall: Make script documentation more clear
Bug: 58549
Change-Id: I9c980da9df2f3c83d6e27147831aa398ed4f4d3b
---
M scripts/catall.py
1 file changed, 8 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/catall.py b/scripts/catall.py
index dbd1705..8585c91 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -1,11 +1,16 @@
# -*- coding: utf-8 -*-
+
"""
-Add or change categories on a number of pages.
+This script shows the categories on each page and lets you change them.
+
+For each page in the target wiki:
+* If the page contains no categories, you can specify a list of categories to
+ add to the page.
+* If the page already contains one or more categories, you can specify a new
+ list of categories to replace the current list of categories of the page.
Usage:
catall.py [start]
-
-Provides the categories on the page and asks whether to change them.
If no starting name is provided, the bot starts at 'A'.
--
To view, visit https://gerrit.wikimedia.org/r/176485
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9c980da9df2f3c83d6e27147831aa398ed4f4d3b
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Gallaecio <adriyetichaves(a)gmail.com>
Gerrit-Reviewer: Gallaecio <adriyetichaves(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: Version 2.0 beta 3
......................................................................
Version 2.0 beta 3
Add list of major changes in new ChangeLog
Change-Id: Iff3bf81448c678ca59fc1bae04c90d9ad337f3a4
---
A ChangeLog
M pywikibot/__init__.py
M setup.py
3 files changed, 32 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..12772a4
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,30 @@
+
+Release 2.0b3 (30 November 2014)
+
+Major changes include:
+- Library initialisation no longer connects to servers
+- generate_user_files.py rewritten
+- API Version 1.14 support
+- Support HTTPS for families with certificate validation errors (Python 2 only)
+- API HTTP(S) GET support
+- API simplified continuation support
+- Upload uses a fake filename to avoid various MIME encoding issues
+- API class ParamInfo inspects API modules
+- Several QueryGenerator efficiency improvements
+- Improved 'same title' detection and 'get redirect target' handling
+- Site interwiki methods now use dynamic Interwikimap
+- Site methods return Namespace object instead of int
+- New WikiStats module
+- New PatchManager module used for showDiff
+- New pagegenerators, including -intersect support
+- Several category_redirect.py improvements
+- archivebot: support more languages
+- reflinks: changed from GPL to MIT
+
+Release 2.0b2 (7 October 2014)
+
+TODO: add list of major changes
+
+Release 2.0b1 (26 August 2013)
+
+TODO: add high level description of changes from pywikibot 1.0
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index d60e45e..feee966 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -5,7 +5,7 @@
#
# Distributed under the terms of the MIT license.
#
-__release__ = '2.0b2'
+__release__ = '2.0b3'
__version__ = '$Id$'
import datetime
diff --git a/setup.py b/setup.py
index 503312a..a0be084 100644
--- a/setup.py
+++ b/setup.py
@@ -94,7 +94,7 @@
from setuptools import setup, find_packages
name = 'pywikibot'
-version = '2.0b2'
+version = '2.0b3'
github_url = 'https://github.com/wikimedia/pywikibot-core'
download_url = github_url + '/archive/master.zip#egg=' + name + '-' + version
--
To view, visit https://gerrit.wikimedia.org/r/176393
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iff3bf81448c678ca59fc1bae04c90d9ad337f3a4
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: 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 <>