← Back to issue list

Some multipass dev versions are considered invalid

View original Github issue

Metadata

Project
craft-providers
Number
#661
Type
issue
State
closed
Author
lengau
Labels
Type: Bug
Created
Updated
Closed

Current evaluation

⚠️ This summary may be outdated — the issue content or evaluation prompts have changed since this evaluation was made.

Closed without resolution. The bug reported that packaging.version.parse fails on certain Multipass dev versions, raising an unhandled InvalidVersion error.

Suggested action:

No scores available.

Issue body

### Bug Description See: https://github.com/canonical/charmcraft/issues/1917 Using `packaging.version.parse` to parse the multipass version `'1.15.0-dev.2929.pr661'` raises an `InvalidVersion`, which isn't caught and bubbles up. We might be able to work around this by replacing hyphens with periods, turning semver strings into [pypa compliant](https://packaging.python.org/en/latest/specifications/version-specifiers/) versions. Otherwise, we could truncate at the first hyphen and attempt to use that, perhaps with a warning. Regardless, we should catch the `InvalidVersion` error and replace it with something nicer. ### To Reproduce Use that version of multipass on a mac ### part yaml ```shell n/a ``` ### Relevant log output ```shell 2024-09-24 19:00:16.880 Executing on host: multipass version 2024-09-24 19:00:16.926 charmcraft internal error: InvalidVersion("Invalid version: '1.15.0-dev.2929.pr661'") 2024-09-24 19:00:16.928 Traceback (most recent call last): 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_application/application.py", line 543, in run 2024-09-24 19:00:16.928 self.run_managed(platform, build_for) 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/charmcraft/application/main.py", line 154, in run_managed 2024-09-24 19:00:16.928 super().run_managed(platform, build_for) 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_application/application.py", line 368, in run_managed 2024-09-24 19:00:16.928 with self.services.provider.instance( 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/lib/python3.10/contextlib.py", line 135, in __enter__ 2024-09-24 19:00:16.928 return next(self.gen) 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/charmcraft/services/provider.py", line 119, in instance 2024-09-24 19:00:16.928 with super().instance( 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/lib/python3.10/contextlib.py", line 135, in __enter__ 2024-09-24 19:00:16.928 return next(self.gen) 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_application/services/provider.py", line 126, in instance 2024-09-24 19:00:16.928 provider.ensure_provider_is_available() 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_providers/multipass/multipass_provider.py", line 165, in ensure_provider_is_available 2024-09-24 19:00:16.928 ensure_multipass_is_ready() 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_providers/multipass/_ready.py", line 41, in ensure_multipass_is_ready 2024-09-24 19:00:16.928 if not multipass.is_supported_version(): 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/craft_providers/multipass/multipass.py", line 161, in is_supported_version 2024-09-24 19:00:16.928 return packaging.version.parse(version) >= minimum_version 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/packaging/version.py", line 56, in parse 2024-09-24 19:00:16.928 return Version(version) 2024-09-24 19:00:16.928 File "/Users/X/.pyenv/versions/3.10.11/envs/charms/lib/python3.10/site-packages/packaging/version.py", line 202, in __init__ 2024-09-24 19:00:16.928 raise InvalidVersion(f"Invalid version: '{version}'") 2024-09-24 19:00:16.928 packaging.version.InvalidVersion: Invalid version: '1.15.0-dev.2929.pr661' 2024-09-24 19:00:16.928 Full execution log: '/Users/X/Library/Logs/charmcraft/charmcraft-20240924-190016.856344.log' ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Closed without resolution. The bug reported that packaging.version.parse fails on certain Multipass dev versions, raising an unhandled InvalidVersion error.
qwen3.6-35b-a3b-mtp-q6 Closed without a public fix. Synced to internal Jira ticket CRAFT-3452. No code changes or pull requests were merged to resolve the InvalidVersion error for multipass dev versions.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.