jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/270577 )
Change subject: [IMPR] Provide a private user script path to be used by pwb.py ...................................................................... [IMPR] Provide a private user script path to be used by pwb.py - A privat script path must be located inside the framework folder. The user_script_path will searched first. - Print a UserWaring when user_script_path is not a list or not a tuple - generate_user_files.py may copy this setting part to user-config Change-Id: I3191a91b32c15cb69b77e3d0c9ccfd402cc3f948 --- M generate_user_files.py M pwb.py M pywikibot/config2.py 3 files changed, 28 insertions(+), 3 deletions(-) Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified diff --git a/generate_user_files.py b/generate_user_files.py index 8e59c8b..3343985 100755 --- a/generate_user_files.py +++ b/generate_user_files.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """Script to create user-config.py.""" # -# (C) Pywikibot team, 2010-2015 +# (C) Pywikibot team, 2010-2016 # # Distributed under the terms of the MIT license. # @@ -255,6 +255,7 @@ res = re.findall("^(# ############# (?:" "LOGFILE|" + 'EXTERNAL SCRIPT PATH|' "INTERWIKI|" "SOLVE_DISAMBIGUATION|" "IMAGE RELATED|" diff --git a/pwb.py b/pwb.py index 96de789..dc015b7 100755 --- a/pwb.py +++ b/pwb.py @@ -9,7 +9,7 @@ and it will use the package directory to store all user files, will fix up search paths so the package does not need to be installed, etc. """ -# (C) Pywikibot team, 2015 +# (C) Pywikibot team, 2015-2016 # # Distributed under the terms of the MIT license. # @@ -212,6 +212,14 @@ script_paths = ['scripts', 'scripts.maintenance', 'scripts.archive'] + from pywikibot import config # flake8: disable=E402 + if config.user_script_paths: + if isinstance(config.user_script_paths, (tuple, list)): + script_paths = config.user_script_paths + script_paths + else: + warn("'user_script_paths' must be a list or tuple,\n" + 'found: {0}. Ignoring this setting.' + ''.format(type(config.user_script_paths))) for file_package in script_paths: paths = file_package.split('.') + [filename] testpath = os.path.join(_pwb_dir, *paths) diff --git a/pywikibot/config2.py b/pywikibot/config2.py index a1aa14f..9f4d72e 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -33,7 +33,7 @@ """ # # (C) Rob W.W. Hooft, 2003 -# (C) Pywikibot team, 2003-2015 +# (C) Pywikibot team, 2003-2016 # # Distributed under the terms of the MIT license. # @@ -516,6 +516,22 @@ # (overrides log setting above) debug_log = [] +# ############# EXTERNAL SCRIPT PATH SETTING ############## +# set your own script path to lookup for your script files. +# your private script path must be located inside the +# framework folder, subfolders must be delimited by '.'. +# every folder must contain an (empty) __init__.py file. +# +# The search order is +# 1. user_script_paths in the given order +# 2. scripts +# 3. scripts/maintenance +# 4. scripts/archive +# +# sample: +# user_script_paths = ['scripts.myscripts'] +user_script_paths = [] + # ############# INTERWIKI SETTINGS ############## # Should interwiki.py report warnings for missing links between foreign -- To view, visit https://gerrit.wikimedia.org/r/270577 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3191a91b32c15cb69b77e3d0c9ccfd402cc3f948 Gerrit-PatchSet: 6 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt <i...@gno.de> Gerrit-Reviewer: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits