jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/647666 )
Change subject: [cleanup] Show a FutureWarning with deprecated api.ParamInfo.modules
......................................................................
[cleanup] Show a FutureWarning with deprecated api.ParamInfo.modules
Change-Id: I7d230cd3cd3346ebfc91eea7101665527cbab867
---
M pywikibot/data/api.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c9f69a7..37e5339 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -657,7 +657,8 @@
return param_data[0]
@property
- @deprecated('submodules() or module_paths', since='20150715')
+ @deprecated('submodules() or module_paths', since='20150715',
+ future_warning=True)
def modules(self) -> Union[Set[str], FrozenSet[str]]:
"""
Set of all main and query modules without path prefixes.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/647666
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I7d230cd3cd3346ebfc91eea7101665527cbab867
Gerrit-Change-Number: 647666
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/650461 )
Change subject: [IMPR] Allow using pywikibot as site-package without user-config.py
......................................................................
[IMPR] Allow using pywikibot as site-package without user-config.py
- also omit all warnings about missing user-config.py
- decrease nested flow statements due to coding convention
- update documentations
Bug: T270474
Change-Id: I586ba53f8eb88b9e4f60eff45d0c9228e972a19a
---
M pywikibot/config2.py
1 file changed, 15 insertions(+), 9 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index cec6bbe..5240a3b 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -11,8 +11,9 @@
will fail to load unless the environment variable PYWIKIBOT_NO_USER_CONFIG
is set to a value other than '0'. i.e. PYWIKIBOT_NO_USER_CONFIG=1 will
allow config to load without a user-config.py. However, warnings will be
-shown if user-config.py was not loaded.
-To prevent these warnings, set PYWIKIBOT_NO_USER_CONFIG=2.
+shown if user-config.py was not loaded. To prevent these warnings, set
+PYWIKIBOT_NO_USER_CONFIG=2. If pywikibot is installed as a site-package
+the behaviour is like PYWIKIBOT_NO_USER_CONFIG=2 is set.
Provides two functions to register family classes which can be used in
the user-config:
@@ -47,6 +48,7 @@
from locale import getdefaultlocale
from os import getenv, environ
+from pathlib import Path
from textwrap import fill
from typing import Optional, Union
from warnings import warn
@@ -89,7 +91,9 @@
_imports = frozenset(name for name in globals() if not name.startswith('_'))
__no_user_config = getenv('PYWIKIBOT_NO_USER_CONFIG')
-if __no_user_config == '0':
+if __no_user_config is None and 'site-packages' in Path(__file__).parts:
+ __no_user_config = '2'
+elif __no_user_config == '0':
__no_user_config = None
@@ -294,7 +298,8 @@
'.pywikibot' directory (Unix and similar) under the user's home
directory.
- Set PYWIKIBOT_NO_USER_CONFIG=1 to disable loading user-config.py
+ Set PYWIKIBOT_NO_USER_CONFIG=1 to disable loading user-config.py or
+ install pywikibot as a site-package.
@param test_directory: Assume that a user config file exists in this
directory. Used to test whether placing a user config file in this
@@ -358,17 +363,18 @@
raise RuntimeError("Directory '%s' does not exist." % base_dir)
# check if user-config.py is in base_dir
if not exists(base_dir):
- exc_text = "No user-config.py found in directory '%s'.\n" % base_dir
- if __no_user_config:
- if __no_user_config != '2':
- output(exc_text)
- else:
+ exc_text = 'No user-config.py found in directory {!r}.\n'.format(
+ base_dir)
+
+ if __no_user_config is None:
exc_text += (
' Please check that user-config.py is stored in the correct '
'location.\n'
' Directory where user-config.py is searched is determined '
'as follows:\n\n ') + get_base_dir.__doc__
raise RuntimeError(exc_text)
+ elif __no_user_config != '2':
+ output(exc_text)
return base_dir
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/650461
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I586ba53f8eb88b9e4f60eff45d0c9228e972a19a
Gerrit-Change-Number: 650461
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/650094 )
Change subject: [bugfix] Use btrfs family for old tests in logentries_tests.py
......................................................................
[bugfix] Use btrfs family for old tests in logentries_tests.py
- Other wowwiki sites are merged to ME 1.33.
Use btrfs family for 'old' test which is still 1.19.24
- Create btrfs family as AutoFamily and assign it to the sites dict
- update aspects to use AutoFamily.name if no str is given with
sites['family']
Bug: T268971
Change-Id: Ibf1c1a14836557621aac6acc4489ef9c1e37afa6
---
M tests/aspects.py
M tests/logentries_tests.py
2 files changed, 7 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 8a8d29b..b48b1cb 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -673,7 +673,8 @@
self.site = sitedata['site']
func(self, key)
- sitename = sitedata['family'] + ':' + sitedata['code']
+ # sitedata['family'] may be an AutoFamily. Use str() for its name
+ sitename = str(sitedata['family']) + ':' + sitedata['code']
if func.__doc__:
if func.__doc__.endswith('.'):
wrapped_method.__doc__ = func.__doc__[:-1]
diff --git a/tests/logentries_tests.py b/tests/logentries_tests.py
index 9b7f1b9..3f685af 100644
--- a/tests/logentries_tests.py
+++ b/tests/logentries_tests.py
@@ -12,6 +12,7 @@
import pywikibot
from pywikibot.exceptions import HiddenKeyError
+from pywikibot.family import AutoFamily
from pywikibot.logentries import (
LogEntryFactory, OtherLogEntry, UserTargetLogEntry)
@@ -50,8 +51,10 @@
'target': None,
},
'old': {
- 'family': 'wowwiki',
- 'code': 'hu',
+ 'family': AutoFamily('btrfs',
+ # /api.php required for scriptpath()
+ 'https://btrfs.wiki.kernel.org/api.php'),
+ 'code': 'btrfs',
'target': None,
}
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/650094
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ibf1c1a14836557621aac6acc4489ef9c1e37afa6
Gerrit-Change-Number: 650094
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/650090 )
Change subject: [bugfix] AutoFamily: type and object must be given for super call
......................................................................
[bugfix] AutoFamily: type and object must be given for super call
Bug: T270370
Change-Id: I0fc8df56695bd9633d615d050718c52753eda0f7
---
M pywikibot/family.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py
index f6115c9..9b1574f 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1398,7 +1398,8 @@
return self.url.path[0:-8]
# AutoFamily refers to the variable set below, not the function
- return super().scriptpath(code)
+ # but the reference must be given here
+ return super(AutoFamily, self).scriptpath(code)
AutoFamily = type('AutoFamily', (SingleSiteFamily,), locals())
return AutoFamily()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/650090
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I0fc8df56695bd9633d615d050718c52753eda0f7
Gerrit-Change-Number: 650090
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged