Skip to content

Commit

Permalink
backend: more careful format_evr()
Browse files Browse the repository at this point in the history
Accept preferably integer or None epoch.
  • Loading branch information
praiskup committed Aug 10, 2023
1 parent 4d51a52 commit f31bc72
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/copr_backend/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,12 @@ def get_chroot_arch(chroot):

def format_evr(epoch, version, release):
"""
Return evr in format (epoch:)version-release
Return evr in format (epoch:)version-release. The argument 'epoch' should
be integer value or null (but we rather also consider "strings" values).
"""
if epoch is not None and epoch.isdigit():
return f"{epoch}:{version}-{release}"

if epoch is not None:
if isinstance(epoch, int) or epoch.isdigit():
return f"{epoch}:{version}-{release}"
return f"{version}-{release}"


Expand Down

0 comments on commit f31bc72

Please sign in to comment.