jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/563660 )
Change subject: [doc] Prepare next release
......................................................................
[doc] Prepare next release
Change-Id: Idbb33ce2db06e3aedff548f664007f048f09644f
---
M HISTORY.rst
M docs/conf.py
2 files changed, 7 insertions(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 2b34323..81868a0 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,12 @@
Current release
---------------
+* Bugfixes and improvements
+* Localisation updates
+
+3.0.20200111
+------------
+
* Fix broken get_version() in setup.py (T198374)
* Rewrite site.log_page/site.unlock_page implementation
* Require requests 2.20.1 (T241934)
diff --git a/docs/conf.py b/docs/conf.py
index 57f1351..1a1cb04 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -71,7 +71,7 @@
# The short X.Y version.
version = '3.0'
# The full version, including alpha/beta/rc tags.
-release = '3.0.20190722'
+release = '3.0.20200111'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
--
To view, visit https://gerrit.wikimedia.org/r/563660
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Idbb33ce2db06e3aedff548f664007f048f09644f
Gerrit-Change-Number: 563660
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/563431 )
Change subject: [bugfix] Fix broken get_version() in setup.py
......................................................................
[bugfix] Fix broken get_version() in setup.py
`python setup.py sdist` does not include .git folder, which
get_version() from setup.py relies on. Therefore
`python setup.py install` from sdist package (also called when running
`pip install pywikibot`) identifies itself with a fallback version
3.0.dev0. This breaks pip when running tasks like `pip freeze`
or `pip install --upgrade`.
This patch adds a possibility to get version from pkg_resources module
of setuptools in such case.
Bug: T198374
Change-Id: Id833db9cf38158afc96d4b5e6e4822c14b6bb485
---
M setup.py
1 file changed, 9 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/setup.py b/setup.py
index 56bf1c2..69e12d7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Installer script for Pywikibot 3.0 framework."""
#
-# (C) Pywikibot team, 2009-2019
+# (C) Pywikibot team, 2009-2020
#
# Distributed under the terms of the MIT license.
#
@@ -164,7 +164,7 @@
test_deps += ['six;python_version>="3"']
-def get_version():
+def get_version(name):
"""Get a valid pywikibot module version string."""
version = '3.0'
try:
@@ -177,7 +177,12 @@
version += '.dev0'
except Exception as e:
print(e)
- version += '.dev0'
+ from pkg_resources import get_distribution, DistributionNotFound
+ try:
+ version = get_distribution(name).version
+ except DistributionNotFound as e:
+ print(e)
+ version += '.dev0'
return version
@@ -205,7 +210,7 @@
name = 'pywikibot'
setup(
name=name,
- version=get_version(),
+ version=get_version(name),
description='Python MediaWiki Bot Framework',
long_description=read_desc('README.rst'),
keywords=['API', 'bot', 'framework', 'mediawiki', 'pwb', 'python',
--
To view, visit https://gerrit.wikimedia.org/r/563431
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id833db9cf38158afc96d4b5e6e4822c14b6bb485
Gerrit-Change-Number: 563431
Gerrit-PatchSet: 6
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/563386 )
Change subject: [doc] Update copyright string to 2020
......................................................................
[doc] Update copyright string to 2020
Change-Id: Ibe23d3992c052191133e733669ceab6266943694
---
M docs/conf.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 0772222..57f1351 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Configuration file for Sphinx."""
#
-# (C) Pywikibot team, 2014-2019
+# (C) Pywikibot team, 2014-2020
#
# Distributed under the terms of the MIT license.
#
@@ -62,7 +62,7 @@
# General information about the project.
project = 'Pywikibot'
-copyright = '2003-2019, Pywikibot team'
+copyright = '2003-2020, Pywikibot team'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
--
To view, visit https://gerrit.wikimedia.org/r/563386
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe23d3992c052191133e733669ceab6266943694
Gerrit-Change-Number: 563386
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/563223 )
Change subject: [doc] Note that pywikibot/compat is deprecated for 5 years
......................................................................
[doc] Note that pywikibot/compat is deprecated for 5 years
- catlib is deprecated since December 2014
- query is deprecated since June 2012
- userlib is deprecated since December 2014
This should be noted in the DIRECTORIES.rst
Change-Id: Iaa484b2df387d2b359b756777f6cb3bf81ec5c19
---
M pywikibot/DIRECTORIES.rst
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/DIRECTORIES.rst b/pywikibot/DIRECTORIES.rst
index 0e5a733..d12b54d 100644
--- a/pywikibot/DIRECTORIES.rst
+++ b/pywikibot/DIRECTORIES.rst
@@ -8,7 +8,7 @@
+---------------------------+------------------------------------------------------+
| pywikibot/comms | Communication layer |
+---------------------------+------------------------------------------------------+
- | pywikibot/compat | Package to provide compatibility with compat scripts |
+ | pywikibot/compat | Deprecated package for use with compat scripts |
+---------------------------+------------------------------------------------------+
| pywikibot/data | Module with several layers for data access to wiki |
+---------------------------+------------------------------------------------------+
--
To view, visit https://gerrit.wikimedia.org/r/563223
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa484b2df387d2b359b756777f6cb3bf81ec5c19
Gerrit-Change-Number: 563223
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/562529 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: I98667b2ea13dcf38f3c69785f2d6d2716a9f8eef
---
M HISTORY.rst
1 file changed, 7 insertions(+), 0 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 8c82a40..0e50b88 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,13 @@
Current release
---------------
+* Rewrite site.log_page/site.unlock_page implementation
+* Require requests 2.20.1 (T241934)
+* Make bot.suggest_help a function
+* Fix gui settings for Python 3.7.4+ (T241216)
+* Better api error message handling (T235500)
+* Ensure that required props exists as Page attribute (T237497)
+* Refactor data loading for WikibaseEntities (T233406)
* replaceCategoryInPlace: Allow LRM and RLM at the end of the old_cat title (T240084)
* Support for Python 3.4 will be dropped (T239542)
* Derive LoginStatus from IntEnum (T213287, T239533)
--
To view, visit https://gerrit.wikimedia.org/r/562529
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I98667b2ea13dcf38f3c69785f2d6d2716a9f8eef
Gerrit-Change-Number: 562529
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/541089 )
Change subject: [IMPR] Rewrite log_page/unlock_page implementation
......................................................................
[IMPR] Rewrite log_page/unlock_page implementation
- Use threading.Condition context manager instead of try/finally
- move test_lock_page from TestSiteGenerators to TestLockingPage
class because this test is not related to a generator
Change-Id: I1ff2c39d43b78d7e71d27720e8ec83e3a48a6925
---
M pywikibot/site.py
M tests/site_tests.py
2 files changed, 24 insertions(+), 43 deletions(-)
Approvals:
Zhuyifei1999: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index fac1d66..f8950f6 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -6,7 +6,7 @@
groups of wikis on the same topic in different languages.
"""
#
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
@@ -780,7 +780,7 @@
self.code in self.family.use_hard_category_redirects)
# following are for use with lock_page and unlock_page methods
- self._pagemutex = threading.Lock()
+ self._pagemutex = threading.Condition()
self._locked_pages = set()
@deprecated(since='20141225')
@@ -880,7 +880,7 @@
def __setstate__(self, attrs):
"""Restore things removed in __getstate__."""
self.__dict__.update(attrs)
- self._pagemutex = threading.Lock()
+ self._pagemutex = threading.Condition()
def user(self):
"""Return the currently-logged in bot username, or None."""
@@ -1065,29 +1065,12 @@
"""
title = page.title(with_section=False)
-
- self._pagemutex.acquire()
- try:
+ with self._pagemutex:
while title in self._locked_pages:
if not block:
raise PageInUse(title)
-
- # The mutex must be released so that page can be unlocked
- self._pagemutex.release()
- time.sleep(.25)
- self._pagemutex.acquire()
-
+ self._pagemutex.wait()
self._locked_pages.add(title)
- finally:
- # time.sleep may raise an exception from signal handler (eg:
- # KeyboardInterrupt) while the lock is released, and there is no
- # reason to acquire the lock again given that our caller will
- # receive the exception. The state of the lock is therefore
- # undefined at the point of this finally block.
- try:
- self._pagemutex.release()
- except RuntimeError:
- pass
def unlock_page(self, page):
"""
@@ -1097,11 +1080,9 @@
@type page: pywikibot.Page
"""
- self._pagemutex.acquire()
- try:
+ with self._pagemutex:
self._locked_pages.discard(page.title(with_section=False))
- finally:
- self._pagemutex.release()
+ self._pagemutex.notify_all()
def disambcategory(self):
"""Return Category in which disambig pages are listed."""
diff --git a/tests/site_tests.py b/tests/site_tests.py
index d700c51..afa9a02 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Tests for the site module."""
#
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
@@ -974,19 +974,6 @@
self.assertIsInstance(link, pywikibot.Page)
self.assertIn(link.namespace(), (2, 3))
- def test_lock_page(self):
- """Test the site.lock_page() and site.unlock_page() method."""
- site = self.get_site()
- p1 = pywikibot.Page(site, 'Foo')
-
- site.lock_page(page=p1, block=True)
- self.assertRaises(pywikibot.site.PageInUse, site.lock_page, page=p1,
- block=False)
- site.unlock_page(page=p1)
- # verify it's unlocked
- site.lock_page(page=p1, block=False)
- site.unlock_page(page=p1)
-
def test_protectedpages_create(self):
"""Test that protectedpages returns protected page titles."""
if self.site.mw_version < '1.15':
@@ -1089,7 +1076,7 @@
self.assertRaises(AssertionError, func, 'm', 2, 1, True, True)
-class TestThreadsLockingPage(DefaultSiteTestCase):
+class TestLockingPage(DefaultSiteTestCase):
"""Test cases for lock/unlock a page within threads."""
cached = True
@@ -1102,8 +1089,8 @@
time.sleep(wait)
page.site.unlock_page(page=page)
- def test_lock_page(self):
- """Test the site.lock_page() and site.unlock_page() method."""
+ def test_threads_locking_page(self):
+ """Test lock_page and unlock_page methods for multiple threads."""
# Start few threads
threads = []
for i in range(5):
@@ -1121,6 +1108,19 @@
self.assertFalse(thread.is_alive(),
'test page is still locked')
+ def test_lock_page(self):
+ """Test the site.lock_page() and site.unlock_page() method."""
+ site = self.get_site()
+ p1 = pywikibot.Page(site, 'Foo')
+
+ site.lock_page(page=p1, block=True)
+ self.assertRaises(pywikibot.site.PageInUse, site.lock_page, page=p1,
+ block=False)
+ site.unlock_page(page=p1)
+ # verify it's unlocked
+ site.lock_page(page=p1, block=False)
+ site.unlock_page(page=p1)
+
class TestSiteGeneratorsUsers(DefaultSiteTestCase):
"""Test cases for Site methods with users."""
--
To view, visit https://gerrit.wikimedia.org/r/541089
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1ff2c39d43b78d7e71d27720e8ec83e3a48a6925
Gerrit-Change-Number: 541089
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Count Count <countvoncount123456(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mineo <themineo(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)