public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-rpm-generators] f45: Correctly handle literal '0' values in RpmVersion parts
@ 2026-08-26 12:02 Karolina Surma
0 siblings, 0 replies; only message in thread
From: Karolina Surma @ 2026-08-26 12:02 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-rpm-generators
Branch : f45
Commit : 6afe8d52718a25063b5ca5c3dbc887b20f7f651c
Author : Karolina Surma <ksurma@redhat.com>
Date : 2026-08-26T12:57:12+02:00
Stats : +5/-5 in 1 file(s)
URL : https://src.fedoraproject.org/rpms/python-rpm-generators/c/6afe8d52718a25063b5ca5c3dbc887b20f7f651c?branch=f45
Log:
Correctly handle literal '0' values in RpmVersion parts
A version string like '0.5.40-0' produces a post suffix 0, which
stopped being included in the converted version string because of a
too broad of a condition.
The converted string before (incomplete): '0.5.40'
The converted string now (correct): '0.5.40^post0'
This reflects the state of the upstream repository as of
https://github.com/gordonmessmer/pyreq2rpm/commit/64474dd1e
---
diff --git a/pythondistdeps.py b/pythondistdeps.py
index 8404292..a982d9f 100755
--- a/pythondistdeps.py
+++ b/pythondistdeps.py
@@ -173,11 +173,11 @@ class RpmVersion():
while len(self.version) > 1 and self.version[-1] == 0:
self.version.pop()
rpm_version = '.'.join(str(x) for x in self.version)
- if self.pre:
+ if self.pre is not None:
rpm_suffix = '~{}'.format(''.join(str(x) for x in self.pre))
- elif self.dev:
+ elif self.dev is not None:
rpm_suffix = '~~dev{}'.format(self.dev)
- elif self.post:
+ elif self.post is not None:
rpm_suffix = '^post{}'.format(self.post)
else:
rpm_suffix = ''
@@ -266,10 +266,10 @@ def convert_ordered(name, operator, version_id):
# For backwards compatibility, fallback to previous behavior with LegacyVersions
if not version.is_legacy():
# Prevent dev and pre-releases from satisfying a < requirement
- if operator == '<' and not version.pre and not version.dev and not version.post:
+ if operator == '<' and version.pre is None and version.dev is None and version.post is None:
version = '{}~~'.format(version)
# Prevent post-releases from satisfying a > requirement
- if operator == '>' and not version.pre and not version.dev and not version.post:
+ if operator == '>' and version.pre is None and version.dev is None and version.post is None:
version = '{}.0'.format(version)
return '{} {} {}'.format(name, operator, version)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-26 12:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-26 12:02 [rpms/python-rpm-generators] f45: Correctly handle literal '0' values in RpmVersion parts Karolina Surma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox