File tree Expand file tree Collapse file tree 2 files changed +23
-20
lines changed
Expand file tree Collapse file tree 2 files changed +23
-20
lines changed Original file line number Diff line number Diff line change 1+ import os
2+
3+ from blurb ._cli import subcommand
4+ from blurb ._git import git_add_files , flush_git_add_files
5+ from blurb ._template import sanitize_section , sections
6+
7+
8+ @subcommand
9+ def populate () -> None :
10+ """Creates and populates the Misc/NEWS.d directory tree."""
11+ os .chdir ('Misc' )
12+ os .makedirs ('NEWS.d/next' , exist_ok = True )
13+
14+ for section in sections :
15+ dir_name = sanitize_section (section )
16+ dir_path = f'NEWS.d/next/{ dir_name } '
17+ os .makedirs (dir_path , exist_ok = True )
18+ readme_path = f'NEWS.d/next/{ dir_name } /README.rst'
19+ with open (readme_path , 'w' , encoding = 'utf-8' ) as readme :
20+ readme .write (f'Put news entry ``blurb`` files for the *{ section } * section in this directory.\n ' )
21+ git_add_files .append (dir_path )
22+ git_add_files .append (readme_path )
23+ flush_git_add_files ()
Original file line number Diff line number Diff line change @@ -474,26 +474,6 @@ def error(*a):
474474 sys .exit ("Error: " + s )
475475
476476
477- @subcommand
478- def populate ():
479- """
480- Creates and populates the Misc/NEWS.d directory tree.
481- """
482- os .chdir ("Misc" )
483- os .makedirs ("NEWS.d/next" , exist_ok = True )
484-
485- for section in sections :
486- dir_name = sanitize_section (section )
487- dir_path = f"NEWS.d/next/{ dir_name } "
488- os .makedirs (dir_path , exist_ok = True )
489- readme_path = f"NEWS.d/next/{ dir_name } /README.rst"
490- with open (readme_path , "wt" , encoding = "utf-8" ) as readme :
491- readme .write (f"Put news entry ``blurb`` files for the *{ section } * section in this directory.\n " )
492- git_add_files .append (dir_path )
493- git_add_files .append (readme_path )
494- flush_git_add_files ()
495-
496-
497477@subcommand
498478def export ():
499479 """
You can’t perform that action at this time.
0 commit comments