Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the last use of pbr with modern packaging #255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Mar 28, 2024

Replace the one last use of pbr in Sphinx configuration with the modern combination of importlib.metadata (builtin) + packaging. Besides avoiding the dependency, it fixes handling VCS versions, that make pbr crash:

Traceback (most recent call last):
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/sphinx/config.py", line 358, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/doc/source/conf.py", line 59, in <module>
    version = version_info.version_string()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 505, in version_string
    return self.semantic_version().brief_string()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 498, in semantic_version
    self._semantic = self._get_version_from_importlib_metadata()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 483, in _get_version_from_importlib_metadata
    return SemanticVersion.from_pip_string(result_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 156, in from_pip_string
    return klass._from_pip_string_unsafe(version_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 226, in _from_pip_string_unsafe
    dev_count = int(component[3:])
                ^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '63+gfba8cc7'

Replace the one last use of pbr in Sphinx configuration with the modern
combination of importlib.metadata (builtin) + packaging.  Besides
avoiding the dependency, it fixes handling VCS versions, that make pbr
crash:

```
Traceback (most recent call last):
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/sphinx/config.py", line 358, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/doc/source/conf.py", line 59, in <module>
    version = version_info.version_string()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 505, in version_string
    return self.semantic_version().brief_string()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 498, in semantic_version
    self._semantic = self._get_version_from_importlib_metadata()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 483, in _get_version_from_importlib_metadata
    return SemanticVersion.from_pip_string(result_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 156, in from_pip_string
    return klass._from_pip_string_unsafe(version_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/requests-mock/.tox/docs/lib/python3.12/site-packages/pbr/version.py", line 226, in _from_pip_string_unsafe
    dev_count = int(component[3:])
                ^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '63+gfba8cc7'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant