jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/398024 )
Change subject: [compat] Remove compat module
......................................................................
[compat] Remove compat module
core branch is now 12 years old and decommission of compat was closed
four years ago. The compat module was created in 2012 and older
catlib and userlib where merged into that folder in 2014.
The framework is not using this compatibility modul anymore and bot
operators got a future warning for their private scripts when the
module is used.
The README-conversion.txt as well as the maintenance/compat2core.py
script was updated years ago not to use this framework part anymore.
There are core framework equivalent parts for userlib, catlib and the
query module and the behaviour of the old parts was never tested.
Anyway the compat implementation of User, Categrory and query is
very different from the core implementation and it is time to take
the next step.
- drop compat library module
- remove references from docs
- remove compat folder from pwb sys path
- update docs
Bug: T183085
Change-Id: I32cd9ca2d1ef32a25f741fe46160317cb649c4ef
---
M HISTORY.rst
M pwb.py
M pywikibot/CONTENT.rst
M pywikibot/DIRECTORIES.rst
D pywikibot/compat/__init__.py
D pywikibot/compat/catlib.py
D pywikibot/compat/query.py
D pywikibot/compat/userlib.py
M scripts/maintenance/compat2core.py
9 files changed, 7 insertions(+), 125 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index d20bf13..e7f4b00 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
Current release
---------------
+* compat module has been removed (T183085)
* Category.copyTo and Category.copyAndKeep methods have been removed
* Use site.userinfo getter instead of site._userinfo within api (T243794)
* Fix endprefix parameter in Category.articles() (T247201)
diff --git a/pwb.py b/pwb.py
index 945694f..28eb5b9 100755
--- a/pwb.py
+++ b/pwb.py
@@ -14,7 +14,7 @@
python pwb.py -lang:de bot_tests -v
"""
-# (C) Pywikibot team, 2012-2019
+# (C) Pywikibot team, 2012-2020
#
# Distributed under the terms of the MIT license.
#
@@ -145,9 +145,8 @@
absolute_path = abspath(os.path.dirname(sys.argv[0]))
rewrite_path = absolute_path
-sys.path = [sys.path[0], rewrite_path,
- os.path.join(rewrite_path, 'pywikibot', 'compat'),
- ] + sys.path[1:]
+if rewrite_path not in sys.path[:2]:
+ sys.path.insert(1, rewrite_path)
try:
import requests
diff --git a/pywikibot/CONTENT.rst b/pywikibot/CONTENT.rst
index 7d56f9d..aa13f59 100644
--- a/pywikibot/CONTENT.rst
+++ b/pywikibot/CONTENT.rst
@@ -87,19 +87,6 @@
+----------------------------+------------------------------------------------------+
- | compat | Package to provide compatibility with compat
scripts.|
- | | (should never be used)
|
-
+============================+======================================================+
- | catlib.py | Library routines written especially to handle
|
- | | category pages and recurse over category contents.
|
-
+----------------------------+------------------------------------------------------+
- | query.py | API query library
|
-
+----------------------------+------------------------------------------------------+
- | userlib.py | Library to work with users, their pages and talk
page|
-
+----------------------------+------------------------------------------------------+
-
-
-
+----------------------------+------------------------------------------------------+
| data | Module providing layers of data access to wiki
|
+============================+======================================================+
| api.py | Interface to Mediawiki's api.php
|
diff --git a/pywikibot/DIRECTORIES.rst b/pywikibot/DIRECTORIES.rst
index d6fff39..3e1fe86 100644
--- a/pywikibot/DIRECTORIES.rst
+++ b/pywikibot/DIRECTORIES.rst
@@ -8,8 +8,6 @@
+---------------------------+------------------------------------------------------+
| pywikibot/comms | Communication layer |
+---------------------------+------------------------------------------------------+
- | pywikibot/compat | Deprecated package for use with compat scripts |
- +---------------------------+------------------------------------------------------+
| pywikibot/data | Module with several layers for data access to wiki |
+---------------------------+------------------------------------------------------+
| pywikibot/families | wiki-specific information and settings |
diff --git a/pywikibot/compat/__init__.py b/pywikibot/compat/__init__.py
deleted file mode 100644
index eaf5879..0000000
--- a/pywikibot/compat/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-"""
diff --git a/pywikibot/compat/catlib.py b/pywikibot/compat/catlib.py
deleted file mode 100644
index b7fb4e9..0000000
--- a/pywikibot/compat/catlib.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-
-Do not use this module anymore; use pywikibot.Category class
-or Page.change_category method instead.
-"""
-#
-# (C) Pywikibot team, 2008-2020
-#
-# Distributed under the terms of the MIT license.
-#
-from __future__ import absolute_import, division, unicode_literals
-
-from pywikibot import Category
-from pywikibot.tools import ModuleDeprecationWrapper
-
-
-def change_category(article, oldCat, newCat, comment=None, sortKey=None,
- inPlace=True):
- """Change the category of the article."""
- return article.change_category(oldCat, newCat, comment, sortKey, inPlace)
-
-
-__all__ = ('Category', 'change_category',)
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper._add_deprecated_attr('Category',
- replacement_name='pywikibot.Category',
- since='20141209', future_warning=True)
-wrapper._add_deprecated_attr('change_category',
- replacement_name='Page.change_category',
- since='20141209', future_warning=True)
diff --git a/pywikibot/compat/query.py b/pywikibot/compat/query.py
deleted file mode 100644
index 967db30..0000000
--- a/pywikibot/compat/query.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-
-Do not use this module anymore; use pywikibot.data.api.Request
-or Page/APISite highlevel methods instead.
-"""
-#
-# (C) Pywikibot team, 2008-2020
-#
-# Distributed under the terms of the MIT license.
-#
-from __future__ import absolute_import, division, unicode_literals
-
-from pywikibot.data import api
-from pywikibot.tools import deprecated, deprecated_args, remove_last_args
-
-
-(a)deprecated('pywikibot.data.api.Request'est', since='20120603',
- future_warning=True)
-@deprecated_args(useAPI=None, retryCount=None, encodeTitle=None)
-@remove_last_args(['back_response'])
-def GetData(request, site=None):
- """
- Query the server with the given request dict.
-
- DEPRECATED: Use pywikibot.data.api.Request instead.
- """
- if site:
- request['site'] = site
-
- req = api.Request(**request)
- return req.submit()
-
-
-__all__ = (GetData, )
diff --git a/pywikibot/compat/userlib.py b/pywikibot/compat/userlib.py
deleted file mode 100644
index c664d3c..0000000
--- a/pywikibot/compat/userlib.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-
-Do not use this module anymore; use pywikibot.User instead.
-"""
-#
-# (C) Pywikibot team, 2008-2020
-#
-# Distributed under the terms of the MIT license.
-#
-from __future__ import absolute_import, division, unicode_literals
-
-from pywikibot.page import User
-from pywikibot.tools import ModuleDeprecationWrapper
-
-__all__ = ('User',)
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper._add_deprecated_attr('User',
- replacement_name='pywikibot.User',
- since='20141209', future_warning=True)
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index 5198780..29b3129 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -26,8 +26,8 @@
python pwb.py compat2core <scriptname> -warnonly
"""
#
-# (C) xqt, 2014-2018
-# (C) Pywikibot team, 2014-2018
+# (C) xqt, 2014-2020
+# (C) Pywikibot team, 2014-2020
#
# Distributed under the terms of the MIT license.
#
@@ -112,7 +112,7 @@
'"wikipedia" library has been changed to "pywikibot". Please
find the\n'
'right way to import your object.'),
('from pywikibot.compat import',
- 'compat module has been dropped. Please refer README-conversion.txt for\n'
+ 'compat module has been removed. Please refer README-conversion.txt for\n'
'core implementation.'),
('query.GetData(',
'query.GetData() should be replaced by pywikibot.data.api.Request or\n'
--
To view, visit
https://gerrit.wikimedia.org/r/398024
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: I32cd9ca2d1ef32a25f741fe46160317cb649c4ef
Gerrit-Change-Number: 398024
Gerrit-PatchSet: 9
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Fantasticfears <fantasticfears(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)