Skip to content

Commit

Permalink
Make sure we have and int flag + added docstrings (rhbz #572770)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Lauridsen committed May 2, 2010
1 parent 692a502 commit 7032e7d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rpmUtils/miscutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,17 @@ def rpm2cpio(fdno, out=sys.stdout, bufsize=2048):
if tmp == "": break
out.write(tmp)
f.close()

def formatRequire (name, version, flags):
'''
Return a human readable requirement string (ex. foobar >= 2.0)
@param name: requirement name (ex. foobar)
@param version: requirent version (ex. 2.0)
@param flags: binary flags ( 0010 = equal, 0100 = greater than, 1000 = less than )
'''
s = name

if flags:
if flags and type(flags) == type(0): # Flag must be set and a int
if flags & (rpm.RPMSENSE_LESS | rpm.RPMSENSE_GREATER |
rpm.RPMSENSE_EQUAL):
s = s + " "
Expand All @@ -358,6 +364,7 @@ def formatRequire (name, version, flags):
if version:
s = "%s %s" %(s, version)
return s


def flagToString(flags):
flags = flags & 0xf
Expand Down

0 comments on commit 7032e7d

Please sign in to comment.