jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1079586?usp=email )
Change subject: [bugfix] import scripts from pywikibot-scripts if site-package is installed ...................................................................... [bugfix] import scripts from pywikibot-scripts if site-package is installed Also update documentation and version. Bug: T377056 Change-Id: If3dcef986e5d9dab9bf1ca335216b571dc4c415d --- M scripts/CHANGELOG.rst M scripts/__init__.py M scripts/checkimages.py M scripts/image.py M scripts/maintenance/make_i18n_dict.py M scripts/misspelling.py M scripts/nowcommons.py M scripts/pyproject.toml M scripts/reflinks.py M scripts/template.py M scripts/watchlist.py 11 files changed, 62 insertions(+), 17 deletions(-) Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst index 9b3753b..89c8c5a 100644 --- a/scripts/CHANGELOG.rst +++ b/scripts/CHANGELOG.rst @@ -1,6 +1,12 @@ Scripts Changelog ================= +9.4.1 +----- + +* import scripts from pywikibot-scripts if site-package is installed (:phab:`T377056`) +* i18n updates + 9.4.0 ----- diff --git a/scripts/__init__.py b/scripts/__init__.py index 109f604..37855d0 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -34,7 +34,7 @@ from pathlib import Path -__version__ = '9.5.0' +__version__ = '9.4.1' #: defines the entry point for pywikibot-scripts package base_dir = Path(__file__).parent diff --git a/scripts/checkimages.py b/scripts/checkimages.py index 0b24bf5..5c7077e 100755 --- a/scripts/checkimages.py +++ b/scripts/checkimages.py @@ -101,7 +101,12 @@ ) from pywikibot.family import Family from pywikibot.site import Namespace -from scripts.welcome import get_welcome_text + + +try: + from scripts.welcome import get_welcome_text +except ModuleNotFoundError: + from pywikibot_scripts.welcome import get_welcome_text ############################################################################### diff --git a/scripts/image.py b/scripts/image.py index 5be3a3b..a8a5632 100755 --- a/scripts/image.py +++ b/scripts/image.py @@ -49,7 +49,12 @@ from pywikibot import i18n, pagegenerators from pywikibot.bot import SingleSiteBot from pywikibot.textlib import case_escape, ignore_case -from scripts.replace import ReplaceRobot as ReplaceBot + + +try: + from scripts.replace import ReplaceRobot as ReplaceBot +except ModuleNotFoundError: + from pywikibot_scripts.replace import ReplaceRobot as ReplaceBot class ImageRobot(ReplaceBot): diff --git a/scripts/maintenance/make_i18n_dict.py b/scripts/maintenance/make_i18n_dict.py index 577d088..5c22a3b 100755 --- a/scripts/maintenance/make_i18n_dict.py +++ b/scripts/maintenance/make_i18n_dict.py @@ -1,14 +1,16 @@ #!/usr/bin/env python3 -""" -Generate an i18n file from a given script. +"""Generate an i18n file from a given script. -run IDLE at topmost level: +Run IDLE at topmost level: >>> import pwb >>> from scripts.maintenance.make_i18n_dict import i18nBot >>> bot = i18nBot('<scriptname>', '<msg dict>') >>> bot.run() +.. hint:: Import from ``pywikibot-scripts`` if scripts are installed as + a site-package. + If you have more than one message dictionary, give all these names to the bot: >>> bot = i18nBot('<scriptname>', '<msg dict1>', '<msg dict2>', '<msg dict3>') @@ -28,7 +30,7 @@ >>> bot.to_json() """ # -# (C) Pywikibot team, 2013-2023 +# (C) Pywikibot team, 2013-2024 # # Distributed under the terms of the MIT license. # diff --git a/scripts/misspelling.py b/scripts/misspelling.py index 46830c8..ef3a50d 100755 --- a/scripts/misspelling.py +++ b/scripts/misspelling.py @@ -21,7 +21,7 @@ given, it starts at the beginning. """ # -# (C) Pywikibot team, 2007-2022 +# (C) Pywikibot team, 2007-2024 # # Distributed under the terms of the MIT license. # @@ -32,9 +32,17 @@ import pywikibot from pywikibot import i18n, pagegenerators -from scripts.solve_disambiguation import DisambiguationRobot as BaseDisambigBot +try: + from scripts.solve_disambiguation import ( + DisambiguationRobot as BaseDisambigBot, + ) +except ModuleNotFoundError: + from pywikibot_scripts.solve_disambiguation import ( + DisambiguationRobot as BaseDisambigBot, + ) + HELP_MSG = """\n misspelling.py does not support site {site}. diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py index db8d202..e8bda2c 100755 --- a/scripts/nowcommons.py +++ b/scripts/nowcommons.py @@ -58,7 +58,12 @@ from pywikibot.bot import ConfigParserBot, CurrentPageBot from pywikibot.exceptions import IsRedirectPageError, NoPageError from pywikibot.tools.itertools import filter_unique -from scripts.image import ImageRobot as ImageBot + + +try: + from scripts.image import ImageRobot as ImageBot +except ModuleNotFoundError: + from pywikibot_scripts.image import ImageRobot as ImageBot nowcommons = { diff --git a/scripts/pyproject.toml b/scripts/pyproject.toml index b2f915f..b1e8481 100644 --- a/scripts/pyproject.toml +++ b/scripts/pyproject.toml @@ -7,7 +7,7 @@ [project] name = "pywikibot-scripts" -version = "9.4.0" +version = "9.4.1" authors = [ {name = "xqt", email = "i...@gno.de"}, @@ -19,12 +19,11 @@ readme = "scripts/README.rst" requires-python = ">=3.7.0" dependencies = [ - "pywikibot >= 9.4.0.dev0", + "pywikibot >= 9.4.0", "isbnlib", "langdetect", "mwparserfromhell", "pydot", - "requests", "unidecode", ] diff --git a/scripts/reflinks.py b/scripts/reflinks.py index 9938011..50c2397 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -72,7 +72,12 @@ ) from pywikibot.textlib import replaceExcept from pywikibot.tools.chars import string2html -from scripts import noreferences + + +try: + from scripts import noreferences +except ModuleNotFoundError: + from pywikibot_scripts import noreferences docuReplacements = { diff --git a/scripts/template.py b/scripts/template.py index 0cbc679..1e57e89 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -101,7 +101,7 @@ python pwb.py template test1 test2 "space test" -subst -ns:3 -always """ # -# (C) Pywikibot team, 2003-2023 +# (C) Pywikibot team, 2003-2024 # # Distributed under the terms of the MIT license. # @@ -115,7 +115,12 @@ from pywikibot.bot import SingleSiteBot from pywikibot.pagegenerators import XMLDumpPageGenerator from pywikibot.tools.itertools import filter_unique, roundrobin_generators -from scripts.replace import ReplaceRobot as ReplaceBot + + +try: + from scripts.replace import ReplaceRobot as ReplaceBot +except ModuleNotFoundError: + from pywikibot_scripts.replace import ReplaceRobot as ReplaceBot class TemplateRobot(ReplaceBot): diff --git a/scripts/watchlist.py b/scripts/watchlist.py index 2be17d6..8a15ec5 100755 --- a/scripts/watchlist.py +++ b/scripts/watchlist.py @@ -37,7 +37,12 @@ from pywikibot import config from pywikibot.data.api import CachedRequest from pywikibot.exceptions import InvalidTitleError -from scripts.maintenance.cache import CacheEntry + + +try: + from scripts.maintenance.cache import CacheEntry +except ModuleNotFoundError: + from pywikibot_scripts.maintenance.cache import CacheEntry def get(site=None) -> list[str]: -- To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1079586?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: If3dcef986e5d9dab9bf1ca335216b571dc4c415d Gerrit-Change-Number: 1079586 Gerrit-PatchSet: 7 Gerrit-Owner: Xqt <i...@gno.de> Gerrit-Reviewer: D3r1ck01 <dalangi-...@wikimedia.org> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot
_______________________________________________ Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org