Skip to content

Commit

Permalink
Merge "[IMPR] Add config.base_dir to scripts search path"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Jan 27, 2024
2 parents 0af6739 + 669ae5f commit 788e5dc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pywikibot/scripts/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ def find_filename(filename):
.. versionchanged:: 7.0
Search users_scripts_paths in config.base_dir
.. versionchanged:: 9.0
Add config.base_dir to search path
"""
from pywikibot import config
path_list = [] # paths to find misspellings
Expand All @@ -391,14 +393,14 @@ def test_paths(paths, root: Path):
path_list.append(testpath.parent)
return None

user_script_paths = []
user_script_paths = ['']
if config.user_script_paths: # pragma: no cover
if isinstance(config.user_script_paths, list):
user_script_paths = config.user_script_paths
user_script_paths += config.user_script_paths
else:
warn("'user_script_paths' must be a list,\n"
'found: {}. Ignoring this setting.'
.format(type(config.user_script_paths)))
f'found: {type(config.user_script_paths).__name__}.'
' Ignoring this setting.')

found = test_paths(user_script_paths, Path(config.base_dir))
if found: # pragma: no cover
Expand Down

0 comments on commit 788e5dc

Please sign in to comment.