Skip to content
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions src/blurb/_populate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os

from blurb._cli import subcommand
from blurb._git import git_add_files, flush_git_add_files
from blurb._template import sanitize_section, sections


@subcommand
def populate() -> None:
"""Creates and populates the Misc/NEWS.d directory tree."""
os.chdir('Misc')
os.makedirs('NEWS.d/next', exist_ok=True)

for section in sections:
dir_name = sanitize_section(section)
dir_path = f'NEWS.d/next/{dir_name}'
os.makedirs(dir_path, exist_ok=True)
readme_path = f'NEWS.d/next/{dir_name}/README.rst'
with open(readme_path, 'w', encoding='utf-8') as readme:
readme.write(f'Put news entry ``blurb`` files for the *{section}* section in this directory.\n')
git_add_files.append(dir_path)
git_add_files.append(readme_path)
flush_git_add_files()
20 changes: 0 additions & 20 deletions src/blurb/blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,26 +474,6 @@ def error(*a):
sys.exit("Error: " + s)


@subcommand
def populate():
"""
Creates and populates the Misc/NEWS.d directory tree.
"""
os.chdir("Misc")
os.makedirs("NEWS.d/next", exist_ok=True)

for section in sections:
dir_name = sanitize_section(section)
dir_path = f"NEWS.d/next/{dir_name}"
os.makedirs(dir_path, exist_ok=True)
readme_path = f"NEWS.d/next/{dir_name}/README.rst"
with open(readme_path, "wt", encoding="utf-8") as readme:
readme.write(f"Put news entry ``blurb`` files for the *{section}* section in this directory.\n")
git_add_files.append(dir_path)
git_add_files.append(readme_path)
flush_git_add_files()


@subcommand
def export():
"""
Expand Down