Skip to content

setup.py: Avoid passing version=None to setup()

Michał Górny requested to merge mgorny/pyocr:setuptools-version into master

Avoid passing version=None to the setup() command as this is causing the following error on Gentoo:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/setuptools/_normalization.py", line 62, in safe_version
    return str(packaging.version.Version(v))
  File "/usr/lib/python3.10/site-packages/packaging/version.py", line 197, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: 'None'

It is unclear why it is happening, it may be due to one of the installed setuptools plugins. However, the problem is easily avoided by passing version only when it actually has a value.

While at it, let's move all the other conditional parameters to a **kwargs dict.

Fixes #127 (closed)

Merge request reports