Skip to content

Commit

Permalink
Add workaround for .dev version parsing not semver
Browse files Browse the repository at this point in the history
The strings Pulp uses, e.g. `3.17.2.dev` is not semver parsable, which
causes the semver tools to fail.

See pulp/plugin_template#682 for more info.

This should only be needed in the 'dev' site since Pulp code will only
every submit data with `.dev` at the end to the dev site.
  • Loading branch information
bmbouter committed Oct 3, 2022
1 parent b29eed4 commit 3678116
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pulpanalytics/management/commands/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def _handle_components(systems, summary):
xyz_dict = defaultdict(int)

for component in components_qs.filter(name=name):
semver_version = semver.parse(component.version)
try:
semver_version = semver.parse(component.version)
except ValueError: # Pulp uses x.y.z.dev which is not semver compatible
component.version = component.version.replace('.dev', '-dev')
semver_version = semver.parse(component.version)
xy_version = f"{semver_version['major']}.{semver_version['minor']}"
xy_dict[xy_version] += 1
xyz_dict[component.version] +=1
Expand Down

0 comments on commit 3678116

Please sign in to comment.