duckinator / bork

A Python build and release management tool.
https://bork.readthedocs.io
MIT License
12 stars 2 forks source link

AttributeError: 'NoneType' object has no attribute 'lower' #345

Closed AstraLuma closed 9 months ago

AstraLuma commented 9 months ago
astraluma@nandi ~/code/ppb/pursuedpybear cirrus-changes @ bork build
Traceback (most recent call last):
  File "/home/astraluma/.local/bin/bork", line 5, in <module>
    from bork.cli import main
  File "/home/astraluma/.local/pipx/venvs/bork/lib64/python3.12/site-packages/bork/cli.py", line 24, in <module>
    from . import api
  File "/home/astraluma/.local/pipx/venvs/bork/lib64/python3.12/site-packages/bork/api.py", line 17, in <module>
    'pypi': pypi.Downloader('pypi'),
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/bork/lib64/python3.12/site-packages/bork/pypi.py", line 27, in __init__
    self.repository_url = self._download_url(repository_name)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/bork/lib64/python3.12/site-packages/bork/pypi.py", line 41, in _download_url
    repo_config = config.get(repository_name, None)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/configparser.py", line 765, in get
    option = self.optionxform(option)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/configparser.py", line 853, in optionxform
    return optionstr.lower()
           ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lower'
nbraud commented 9 months ago

Exciting!.. and I don't even think we touched the downloaders recently, so that must be an old bug >_>'

nbraud commented 9 months ago

@AstraLuma Could you test whether #346 fixes your issue?

AstraLuma commented 9 months ago

Looks like it works locally.

duckinator commented 9 months ago

@AstraLuma what version of Python do you use locally? I suspect it's a Python 3.12 API change.

EDIT: Nope, it's not. Documentation for ConfigParser.get hasn't changed since at least 3.8. No idea what's up.

duckinator commented 9 months ago

The more I dig into this, the more confused I get.

First, I'm confused why it's breaking now, because:

And second I'm confused because... bork build shouldn't be interacting with this part of the codebase, yet it clearly is. I think this boils down to how and where bork.api.DOWNLOAD_SOURCES is defined. It might make sense to move that definition into bork.api.download().

duckinator commented 9 months ago

I think this bug was lurking there as long as bork download has existed, but only shows up if #339 / #349 (not specifying project.name in pyproject.toml) becomes relevant.