in pelican/plugin_paths.py [0:0]
def main():
"""
Parse the file and generate the JSON output
"""
path = sys.argv[1] # path to append
if len(sys.argv) > 2:
file = sys.argv[2] # the file to parse
else:
file = DEFAULT_PELCONF
with open(file, 'r', encoding='utf-8') as infile:
contents = infile.read()
# This will contain the "globals" after executing the peliconconf.py.
# Note: allow all builtins (by virtue of NOT inserting a __builtins__
# value into this dictionary. We have no concerns about builtin usage.
values = { }
# Run the pelicanconf.py code into VALUES. We do not want to import
# this as a module, as we're only going for the variable values.
exec(contents, values) # pylint: disable=exec-used
plugdir = values.get('PLUGIN_PATHS', [])
plugdir.append(path)
print(f"PLUGIN_PATHS={json.dumps(plugdir)}")