Skip to content

Commit

Permalink
Provide an argument for pointing to global plugins.
Browse files Browse the repository at this point in the history
If a pelican site uses the old-style pelicanconf.py, then we
auto-insert some plugins. We also need to auto-insert a path to those
plugins when running locally (the production install on buildbot is
already handled).

Thus: add a new --plugins cmdline argument.

Then add that argument into devtest/compare.sh
  • Loading branch information
gstein committed Jul 12, 2023
1 parent a465c7d commit 588e3a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion bin/buildsite.py
Expand Up @@ -134,11 +134,18 @@ def start_build(args):
else:
# The default name, but we'll pass it explicitly.
settings_path = os.path.join(sourcepath, PELICAN_CONF)
#print('SETTINGS_PATH:', settings_path)

if args.plugins:
ppaths = (f'PLUGIN_PATHS=["{args.plugins}",'
f' "{sourcepath}/theme/plugins"]')
else:
ppaths = ''
# Set currently supported plugins
### this needs to be removed, as it is too indeterminate.
with open(settings_path, 'a') as f:
f.write("""
f.write(f"""
{ppaths}
try:
PLUGINS += ['toc']
except Exception: # TODO: narrow further to expected Exceptions
Expand Down Expand Up @@ -458,6 +465,7 @@ def main():
parser_git.add_argument("--listen", help = "Start pelican -l after build (default: %(default)s)", action = "store_true")
parser_git.add_argument("--debug", help = "Run pelican with debug flag (show full exception traces)", action = "store_true")
parser_git.add_argument("--delete", help = "Delete output directory first", action = "store_true")
parser_git.add_argument("--plugins", help = "Directory for global plugins")
parser_git.set_defaults(func=locked_build)

parser_dir = subparsers.add_parser("dir", help = "Build source in current directory and optionally serve the result")
Expand Down
2 changes: 1 addition & 1 deletion devtest/compare.sh
Expand Up @@ -25,7 +25,7 @@ cd "$source"
git checkout "$branch"

# Now build the site into /tmp/$project/
"$bindir/buildsite.py" git --project "$project" --source "$source" --sourcebranch "$branch" || exit 1
"$bindir/buildsite.py" git --project "$project" --source "$source" --sourcebranch "$branch" --plugins "$absdir"/plugins || exit 1

# Switch to what the current/prior website looks like
git checkout asf-site
Expand Down

0 comments on commit 588e3a9

Please sign in to comment.