Skip to content

Commit

Permalink
Small improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers committed May 14, 2007
1 parent 8f3ebff commit cebbca5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mrepo
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ def vercmp(a, b):
return -1
elif cmp(al[i], bl[i]) > 0:
return 1
return 0
return cmp(len(al), len(bl))

def symlinkglob(str, *targets):
"Symlink files to multiple targets"
Expand Down
26 changes: 26 additions & 0 deletions tests/createrepo_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/python

import sys

def vercmp(a, b):
al = a.split('.')
bl = b.split('.')
length = min(len(al), len(bl))
for i in range(1, length):
if cmp(al[i], bl[i]) < 0:
return -1
elif cmp(al[i], bl[i]) > 0:
return 1
return cmp(len(al), len(bl))

sys.path.append("/usr/share/createrepo")
import genpkgmetadata
print genpkgmetadata.__version__
sys.path.remove("/usr/share/createrepo")
del genpkgmetadata

print vercmp('0.4.4', '0.4.6')
print vercmp('0.4.8', '0.4.6')
print vercmp('0.4.6', '0.4.6')
print vercmp('0.4.6.0', '0.4.6')
print vercmp('0.4.6.1', '0.4.6')

0 comments on commit cebbca5

Please sign in to comment.