Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import os
import pprint
import shlex
import shutil
import subprocess
import sys
import textwrap
from pathlib import Path
Expand Down Expand Up @@ -357,7 +358,8 @@ def write_template_section(config, name, plugin_root_dir, verbose=False):
**config,
}

for relative_path in generate_relative_path_set(section_template_dir):
relative_path_set = generate_relative_path_set(section_template_dir)
for relative_path in relative_path_set:
if not config["stalebot"] and "stale" in relative_path:
continue
if config["use_issue_template"] is False and "ISSUE_TEMPLATE" in relative_path:
Expand Down Expand Up @@ -403,6 +405,17 @@ def write_template_section(config, name, plugin_root_dir, verbose=False):
if verbose:
print(f"Copied file: {relative_path}")

if config["black"]:
black_paths = filter(lambda x: x.endswith(".py.j2"), relative_path_set)
black_paths = map(lambda x: x[: -len(".j2")], black_paths)
black_paths = map(
lambda x: x.replace("plugin_name", utils.to_snake(config["plugin_name"])), black_paths
)
black_paths = filter(
lambda x: os.path.exists(os.path.join(plugin_root_dir, x)), black_paths
)
subprocess.run(["black", "--quiet"] + list(black_paths), cwd=plugin_root_dir)

print(f"Section: {name} \n templated: {files_templated}\n copied: {files_copied}")
return 0

Expand Down