Author: wade
Date: 2005-12-09 18:52:50 -0500 (Fri, 09 Dec 2005)
New Revision: 54181
Modified:
trunk/release/rpmvercmp/version_compare
Log:
Not sure what happened there...
Modified: trunk/release/rpmvercmp/version_compare
===================================================================
--- trunk/release/rpmvercmp/version_compare 2005-12-09 23:52:27 UTC (rev
54180)
+++ trunk/release/rpmvercmp/version_compare 2005-12-09 23:52:50 UTC (rev
54181)
@@ -66,199 +66,3 @@
commandline()
-
-#!/usr/bin/env python
-
-import sys
-import string
-import re
-
-# Delimiters ordered by sort preference (earlier in list has lower preference)
-delimiters = '-.'
-
-delimit_match = re.compile("[%s]" % delimiters)
-
-def compare_with_operator(string1, string2, operator):
- pass
-
-# Takes an array of strings and sorts "doing the right thing"
-# (specifically for filenames with versions in them)
-def version_compare(string1, string2):
-
- # First, split these strings on delimeters, namely, '.' and '-'
-
- # Then, going down each of the paired lists, do string comparisons,
- # but if they are equal, give preference to certain preceding
delimiters (in our case, '.')
- list1 = delimit_match.split(string1)
- list2 = delimit_match.split(string2)
-
- list1_len = len(list1)
- list2_len = len(list2)
-
- result = 0
- # Have i count up to the smaller of the two lists
- for i in range(min(len(list1), len(list2))):
- print "First %s" % list1[i]
- print "Second %s" % list2[i]
- # Only continue through the list if they are equivalent
- if list1[i] == list2[i]:
- result = 0
- elif list1[i] > list2[i]:
- result = 1
- break
- elif list1[i] < list2[i]:
- result = -1
- break
-
- # Or,
- # First, split on first delimiter, for each of those, split second
delimited, and compare
-
- return result
-
-
-def commandline():
- version_strings = sys.argv[1:]
-
- # Sort using our method
- version_strings.sort(version_compare)
-
- for str in version_strings:
- print str,
-
-
-# If called from the command line, run main, otherwise, functions are callable
through imports
-if __name__ == "__main__":
- commandline()
-
-
-
-#!/usr/bin/env python
-
-import sys
-import string
-import re
-
-# Delimiters ordered by sort preference (earlier in list has lower preference)
-delimiters = '-.'
-
-delimit_match = re.compile("[%s]" % delimiters)
-
-def compare_with_operator(string1, string2, operator):
- pass
-
-# Takes an array of strings and sorts "doing the right thing"
-# (specifically for filenames with versions in them)
-def version_compare(string1, string2):
-
- # First, split these strings on delimeters, namely, '.' and '-'
-
- # Then, going down each of the paired lists, do string comparisons,
- # but if they are equal, give preference to certain preceding
delimiters (in our case, '.')
- list1 = delimit_match.split(string1)
- list2 = delimit_match.split(string2)
-
- list1_len = len(list1)
- list2_len = len(list2)
-
- result = 0
- # Have i count up to the smaller of the two lists
- for i in range(min(len(list1), len(list2))):
- print "First %s" % list1[i]
- print "Second %s" % list2[i]
- # Only continue through the list if they are equivalent
- if list1[i] == list2[i]:
- result = 0
- elif list1[i] > list2[i]:
- result = 1
- break
- elif list1[i] < list2[i]:
- result = -1
- break
-
- # Or,
- # First, split on first delimiter, for each of those, split second
delimited, and compare
-
- return result
-
-
-def commandline():
- version_strings = sys.argv[1:]
-
- # Sort using our method
- version_strings.sort(version_compare)
-
- for str in version_strings:
- print str,
-
-
-# If called from the command line, run main, otherwise, functions are callable
through imports
-if __name__ == "__main__":
- commandline()
-
-
-
-#!/usr/bin/env python
-
-import sys
-import string
-import re
-
-# Delimiters ordered by sort preference (earlier in list has lower preference)
-delimiters = '-.'
-
-delimit_match = re.compile("[%s]" % delimiters)
-
-def compare_with_operator(string1, string2, operator):
- pass
-
-# Takes an array of strings and sorts "doing the right thing"
-# (specifically for filenames with versions in them)
-def version_compare(string1, string2):
-
- # First, split these strings on delimeters, namely, '.' and '-'
-
- # Then, going down each of the paired lists, do string comparisons,
- # but if they are equal, give preference to certain preceding
delimiters (in our case, '.')
- list1 = delimit_match.split(string1)
- list2 = delimit_match.split(string2)
-
- list1_len = len(list1)
- list2_len = len(list2)
-
- result = 0
- # Have i count up to the smaller of the two lists
- for i in range(min(len(list1), len(list2))):
- print "First %s" % list1[i]
- print "Second %s" % list2[i]
- # Only continue through the list if they are equivalent
- if list1[i] == list2[i]:
- result = 0
- elif list1[i] > list2[i]:
- result = 1
- break
- elif list1[i] < list2[i]:
- result = -1
- break
-
- # Or,
- # First, split on first delimiter, for each of those, split second
delimited, and compare
-
- return result
-
-
-def commandline():
- version_strings = sys.argv[1:]
-
- # Sort using our method
- version_strings.sort(version_compare)
-
- for str in version_strings:
- print str,
-
-
-# If called from the command line, run main, otherwise, functions are callable
through imports
-if __name__ == "__main__":
- commandline()
-
-
-
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches