Skip to content

blurb merge: "No 'section' specified. You must provide one!" #525

@hugovk

Description

@hugovk

The short story

Error with blurb merge, with the unreleased version.

Long version

With current CPython main (commit 981d172f7f0613d30bef4a8934b361db7fcf0672), run blurb merge:

❯ blurb merge
You already have a 'Misc/NEWS' file.
[Type ok to overwrite> ok
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/blurb", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/hugo/github/core-workflow/blurb/blurb.py", line 1288, in main
    sys.exit(fn(*filtered_args, **kwargs))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hugo/github/core-workflow/blurb/blurb.py", line 1067, in merge
    write_news(output, versions=versions)
  File "/Users/hugo/github/core-workflow/blurb/blurb.py", line 1099, in write_news
    blurbs.load(filenames[0])
  File "/Users/hugo/github/core-workflow/blurb/blurb.py", line 541, in load
    self.parse(text, metadata=metadata, filename=filename)
  File "/Users/hugo/github/core-workflow/blurb/blurb.py", line 531, in parse
    finish_entry()
  File "/Users/hugo/github/core-workflow/blurb/blurb.py", line 502, in finish_entry
    throw("No 'section' specified.  You must provide one!")
  File "/Users/hugo/github/core-workflow/blurb/blurb.py", line 459, in throw
    raise BlurbError(f"Error in {filename}:{line_number}:\n{s}")
blurb.BlurbError: Error in Misc/NEWS.d/3.6.2.rst:7:
No 'section' specified.  You must provide one!

The last released 1.1.0 still works.

git bisect points to a0db0d9:

a0db0d98b41ef1debf443c988c450de278932ee2 is the first bad commit
commit a0db0d98b41ef1debf443c988c450de278932ee2
Date:   Sun Jul 23 06:36:51 2023 -0700

    Improved error checking when parsing a Blurb. (#507)

    We now:
    * Check the entries in metadata in order, so we complain about
      the *first* one that has an error, which is a more familiar
      user experience.
    * Have checks for:
            * Invalid issue number
            * Invalid section
            * Empty section
            * Completely missing section

    (There is no test for "missing issue number", because it's legal
    to have a Blurb with no issue number.  "no changes" blurbs don't
    have an issue number.  But we do now reliably test that, *if* the
    issue number is specified, it *is* correctly formatted.)

 blurb/blurb.py                         | 54 +++++++++++++++++++++-------------
 blurb/tests/fail/invalid-gh-number.rst |  4 +++
 blurb/tests/fail/invalid-section.rst   |  4 +++
 blurb/tests/fail/no-gh-number.rst      |  4 +++
 blurb/tests/fail/no-section.rst        |  3 ++
 5 files changed, 49 insertions(+), 20 deletions(-)
 create mode 100644 blurb/tests/fail/invalid-gh-number.rst
 create mode 100644 blurb/tests/fail/invalid-section.rst
 create mode 100644 blurb/tests/fail/no-gh-number.rst
 create mode 100644 blurb/tests/fail/no-section.rst

Added in #507.

Whilst it's useful to check for a missing section in normal , maybe we should allow missing sections in combined Misc/NEWS.d/x.y.z.rst files?

We could skip the three problematic files:

-            if not 'section' in metadata:
+            if 'section' not in metadata and filename not in [
+                "Misc/NEWS.d/3.5.3.rst",
+                "Misc/NEWS.d/3.6.0.rst",
+                "Misc/NEWS.d/3.6.2.rst",
+            ]:
                 throw("No 'section' specified.  You must provide one!")

Or generally:

-            if not 'section' in metadata:
+            if 'section' not in metadata and filename.startswith("Misc/NEWS.d/next"):
                 throw("No 'section' specified.  You must provide one!")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy