ansible-community / antsichaut

Antsichaut aims to automate the filling of a changelog.yaml used by antsibull-changelog

Home Page:https://pypi.org/project/antsichaut/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Release 0.3.0 is broken?

paulfantom opened this issue · comments

I was just installing antsichaut 0.3.0 with pip and it seems that the package is broken and contains code that is not present in this repository.

While using the software I got the following error:

$ antsichaut --repository $REPOSITORY                       (ankhmorpork:homeassistant) paulfantom@fedora
{}
Traceback (most recent call last):
  File "/home/paulfantom/.local/bin/antsichaut", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/paulfantom/.local/lib/python3.11/site-packages/antsichaut/antsichaut.py", line 431, in main
    ci.run()
  File "/home/paulfantom/.local/lib/python3.11/site-packages/antsichaut/antsichaut.py", line 267, in run
    string_data = self.parse_changelog(changes)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paulfantom/.local/lib/python3.11/site-packages/antsichaut/antsichaut.py", line 188, in parse_changelog
    new_version = list(dict(dict(data)["releases"]))[-1]
                            ~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'releases'

After digging a bit into code I found that parse_changelog function from release package looks like this:

     def parse_changelog(self, changes):
         """Parse the pull requests data and return a string"""
         yaml = YAML()
 
         write_fragments = True
         if write_fragments:
             data = {}
         else:
             with open(
                 "changelogs/changelog.yaml",
             ) as file:
                 data = yaml.load(file)
 
         # get the new version from the changelog.yaml
         # by using the last item in the list of releases
         new_version = list(dict(dict(data)["releases"]))[-1]

Since write_fragments there is always True the program won't ever read the changelog file :(

Sorry for that! I accidentally built and published a working state locally.

I released 0.3.1 which should fix this issue.