Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2017-10-25 17:16:47 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2017-11-09 18:27:05 +0300
commit0af273df25f3d930dfa25a2b5dc49b9e4e4261ab (patch)
treee5d80df5bd10ca120ccb3d79d0636e4b8fe12406
parent84829a01884989f65e49e8163dcc7eb3cec9d888 (diff)
Trim components of obsoletes: and depends: when we sort them
Don't want components to be sorted with any leading whitespace
-rwxr-xr-xcalm/hint.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/calm/hint.py b/calm/hint.py
index a5a51d6..dcdbd5f 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -190,6 +190,13 @@ def item_lexer(c):
yield (i, o, None)
+def split_trim_sort_join(hint, splitchar, joinchar=None):
+ if joinchar is None:
+ joinchar = splitchar + ' '
+
+ return joinchar.join(sorted([s.strip() for s in hint.split(splitchar)]))
+
+
# parse the file |fn| as a .hint file of kind |kind|
def hint_file_parse(fn, kind):
hints = OrderedDict()
@@ -297,13 +304,13 @@ def hint_file_parse(fn, kind):
# sort these hints, as differences in ordering are uninteresting
if 'requires' in hints:
- hints['requires'] = ' '.join(sorted(hints['requires'].split()))
+ hints['requires'] = split_trim_sort_join(hints['requires'], None, ' ')
if 'depends' in hints:
- hints['depends'] = ','.join(sorted(hints['depends'].split(',')))
+ hints['depends'] = split_trim_sort_join(hints['depends'], ',')
if 'obsoletes' in hints:
- hints['obsoletes'] = ','.join(sorted(hints['obsoletes'].split(',')))
+ hints['obsoletes'] = split_trim_sort_join(hints['obsoletes'], ',')
except UnicodeDecodeError:
errors.append('invalid UTF-8')