jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/743362 )
Change subject: [IMPR] Enable shell script with Pywikibot site package ......................................................................
[IMPR] Enable shell script with Pywikibot site package
- move shell.py script to pywikibot/scripts - update tests - update docs
Change-Id: I69a91037632bbe2d90ed231f51c119b255f7f3ad --- M docs/glossary.rst M docs/scripts/scripts.rst M docs/utilities/index.rst M pywikibot/CONTENT.rst M pywikibot/bot.py R pywikibot/scripts/shell.py M scripts/README.rst M tests/script_tests.py 8 files changed, 24 insertions(+), 15 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/docs/glossary.rst b/docs/glossary.rst index a750eee..7361e7b 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -9,7 +9,8 @@ The default Python prompt of the interactive Pywikibot shell. Often seen for code examples which can be executed interactively in the interpreter. The :mod:`pywikibot` module is preloaded. The - :mod:`scripts.shell` script is part of the :mod:`scripts` module. + :mod:`pywikibot.scripts.shell` script is part of the + :ref:`Pywikibot Utility Scripts<utility_scripts>`.
compat The first Pywikibot package formerly known as *Pywikipediabot* diff --git a/docs/scripts/scripts.rst b/docs/scripts/scripts.rst index 86ec7d3..1787469 100644 --- a/docs/scripts/scripts.rst +++ b/docs/scripts/scripts.rst @@ -207,11 +207,6 @@
.. automodule:: scripts.revertbot
-shell script ------------- - -.. automodule:: scripts.shell - solve_disambiguation script ----------------------------
diff --git a/docs/utilities/index.rst b/docs/utilities/index.rst index 5e61800..0a8cc7e 100644 --- a/docs/utilities/index.rst +++ b/docs/utilities/index.rst @@ -1,3 +1,5 @@ +.. _utility_scripts: + Utility scripts ===============
@@ -6,11 +8,6 @@
.. automodule:: pwb
-version script --------------- - -.. automodule:: pywikibot.scripts.version - generate_family_file script -----------------------------
@@ -20,3 +17,13 @@ ----------------------------
.. automodule:: pywikibot.scripts.generate_user_files + +shell script +------------ + +.. automodule:: pywikibot.scripts.shell + +version script +-------------- + +.. automodule:: pywikibot.scripts.version diff --git a/pywikibot/CONTENT.rst b/pywikibot/CONTENT.rst index 468259a..13a77df 100644 --- a/pywikibot/CONTENT.rst +++ b/pywikibot/CONTENT.rst @@ -119,6 +119,9 @@ +----------------------------+------------------------------------------------------+ | pwb.py | Code entry wrapper script (site-package only) | +----------------------------+------------------------------------------------------+ + | shell.py | Spawns an interactive Python shell with pywikibot | + | | imported | + +----------------------------+------------------------------------------------------+ | version.py | Outputs Pywikibot's revision number, Python's | | | version and OS used. | +----------------------------+------------------------------------------------------+ diff --git a/pywikibot/bot.py b/pywikibot/bot.py index b8df65d..d1e3699 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -1780,7 +1780,7 @@ # edit summary for the bot. summary = Bot: Aggiungo template Categorizzare
- [shell] ; Shell options + [commonscat] ; commonscat options always: true
The option values are interpreted in this order: diff --git a/scripts/shell.py b/pywikibot/scripts/shell.py similarity index 96% rename from scripts/shell.py rename to pywikibot/scripts/shell.py index f105182..58143ba 100755 --- a/scripts/shell.py +++ b/pywikibot/scripts/shell.py @@ -12,6 +12,9 @@ python pwb.py shell [args]
If no arguments are given, the pywikibot library will not be loaded. + +.. versionchanged:: 7.0 + moved to pywikibot.scripts """ # (C) Pywikibot team, 2014-2021 # diff --git a/scripts/README.rst b/scripts/README.rst index c4bf53f..8c417a8 100644 --- a/scripts/README.rst +++ b/scripts/README.rst @@ -123,8 +123,6 @@ +------------------------+---------------------------------------------------------+ | revertbot.py | Script that can be used for reverting certain edits. | +------------------------+---------------------------------------------------------+ - | shell.py | Spawns an interactive Python shell. | - +------------------------+---------------------------------------------------------+ | solve_disambiguation.py| Interactive robot doing disambiguation. | +------------------------+---------------------------------------------------------+ | speedy_delete.py | Help sysops to quickly check and/or delete pages listed | diff --git a/tests/script_tests.py b/tests/script_tests.py index 6f9b47f..18a9e8e 100644 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -17,6 +17,7 @@
scripts_path = join_root_path('scripts') +framework_scripts = ['shell']
# These dependencies are not always the package name which is in setup.py. # Here, the name given to the module which will be imported is required. @@ -55,7 +56,8 @@ return scripts
-script_list = ['login'] + list_scripts(scripts_path, exclude='login.py') +script_list = ['login'] + list_scripts(scripts_path, + exclude='login.py') + framework_scripts
script_input = { 'interwiki': 'Test page that should not exist\n',
pywikibot-commits@lists.wikimedia.org