|
39 | 39 | # |
40 | 40 | # automatic git adds and removes |
41 | 41 |
|
42 | | -import atexit |
43 | 42 | import base64 |
44 | 43 | import builtins |
45 | 44 | import glob |
|
49 | 48 | import os |
50 | 49 | from pathlib import Path |
51 | 50 | import re |
52 | | -import shlex |
53 | 51 | import shutil |
54 | 52 | import subprocess |
55 | 53 | import sys |
56 | | -import tempfile |
57 | 54 | import textwrap |
58 | 55 | import time |
59 | 56 |
|
60 | 57 | from blurb._cli import main, subcommand |
61 | 58 | from blurb._template import ( |
62 | 59 | next_filename_unsanitize_sections, sanitize_section, |
63 | | - sanitize_section_legacy, sections, template, unsanitize_section, |
| 60 | + sanitize_section_legacy, sections, unsanitize_section, |
64 | 61 | ) |
65 | 62 |
|
66 | 63 | root = None # Set by chdir_to_repo_root() |
@@ -156,10 +153,6 @@ def textwrap_body(body, *, subsequent_indent=''): |
156 | 153 | text += "\n" |
157 | 154 | return text |
158 | 155 |
|
159 | | - |
160 | | -def current_date(): |
161 | | - return time.strftime("%Y-%m-%d", time.localtime()) |
162 | | - |
163 | 156 | def sortable_datetime(): |
164 | 157 | return time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()) |
165 | 158 |
|
@@ -566,65 +559,6 @@ def _find_blurb_dir(): |
566 | 559 | return None |
567 | 560 |
|
568 | 561 |
|
569 | | -@subcommand |
570 | | -def release(version): |
571 | | - """ |
572 | | -Move all new blurbs to a single blurb file for the release. |
573 | | -
|
574 | | -This is used by the release manager when cutting a new release. |
575 | | - """ |
576 | | - if version == ".": |
577 | | - # harvest version number from dirname of repo |
578 | | - # I remind you, we're in the Misc subdir right now |
579 | | - version = os.path.basename(root) |
580 | | - |
581 | | - existing_filenames = glob_blurbs(version) |
582 | | - if existing_filenames: |
583 | | - error("Sorry, can't handle appending 'next' files to an existing version (yet).") |
584 | | - |
585 | | - output = f"Misc/NEWS.d/{version}.rst" |
586 | | - filenames = glob_blurbs("next") |
587 | | - blurbs = Blurbs() |
588 | | - date = current_date() |
589 | | - |
590 | | - if not filenames: |
591 | | - print(f"No blurbs found. Setting {version} as having no changes.") |
592 | | - body = f"There were no new changes in version {version}.\n" |
593 | | - metadata = {"no changes": "True", "gh-issue": "0", "section": "Library", "date": date, "nonce": nonceify(body)} |
594 | | - blurbs.append((metadata, body)) |
595 | | - else: |
596 | | - count = len(filenames) |
597 | | - print(f'Merging {count} blurbs to "{output}".') |
598 | | - |
599 | | - for filename in filenames: |
600 | | - if not filename.endswith(".rst"): |
601 | | - continue |
602 | | - blurbs.load_next(filename) |
603 | | - |
604 | | - metadata = blurbs[0][0] |
605 | | - |
606 | | - metadata['release date'] = date |
607 | | - print("Saving.") |
608 | | - |
609 | | - blurbs.save(output) |
610 | | - git_add_files.append(output) |
611 | | - flush_git_add_files() |
612 | | - |
613 | | - how_many = len(filenames) |
614 | | - print(f"Removing {how_many} 'next' files from git.") |
615 | | - git_rm_files.extend(filenames) |
616 | | - flush_git_rm_files() |
617 | | - |
618 | | - # sanity check: ensuring that saving/reloading the merged blurb file works. |
619 | | - blurbs2 = Blurbs() |
620 | | - blurbs2.load(output) |
621 | | - assert blurbs2 == blurbs, f"Reloading {output} isn't reproducible?!" |
622 | | - |
623 | | - print() |
624 | | - print("Ready for commit.") |
625 | | - |
626 | | - |
627 | | - |
628 | 562 | @subcommand |
629 | 563 | def merge(output=None, *, forced=False): |
630 | 564 | """ |
|
0 commit comments