public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Karolina Surma <ksurma@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-rpm-generators] f45: Correctly handle literal '0' values in RpmVersion parts
Date: Wed, 26 Aug 2026 12:02:00 GMT	[thread overview]
Message-ID: <178774572073.1.18032376282674264849.rpms-python-rpm-generators-6afe8d52718a@fedoraproject.org> (raw)

            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)
 

                 reply	other threads:[~2026-08-26 12:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178774572073.1.18032376282674264849.rpms-python-rpm-generators-6afe8d52718a@fedoraproject.org \
    --to=ksurma@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox