From 908e5a1a437bb7907f78fac8cfecdfa92e26bad0 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Sun, 3 Mar 2024 07:43:14 -0300 Subject: build: sort.py: filter empty and duplicate items Note: This seems to already be done for `protocol` lines. Before: $ ./contrib/sort.py test.profile sort.py: checking 1 profile(s)... test.profile:1:-private-etc ,,bar,,foo,,bar,,, test.profile:1:+private-etc ,,,,,,,bar,bar,foo test.profile:2:-protocol ,,unix,,bluetooth,,unix,,inet,,, test.profile:2:+protocol unix,inet,bluetooth [ Fixed ] test.profile After: $ ./contrib/sort.py test.profile sort.py: checking 1 profile(s)... test.profile:1:-private-etc ,,bar,,foo,,bar,,, test.profile:1:+private-etc bar,foo test.profile:2:-protocol ,,unix,,bluetooth,,unix,,inet,,, test.profile:2:+protocol unix,inet,bluetooth [ Fixed ] test.profile --- contrib/sort.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'contrib') diff --git a/contrib/sort.py b/contrib/sort.py index b70f83e6c..7a4f57da4 100755 --- a/contrib/sort.py +++ b/contrib/sort.py @@ -38,7 +38,8 @@ Exit Codes: def sort_alphabetical(original_items): items = original_items.split(",") - items.sort() + items = filter(None, set(items)) + items = sorted(items) return ",".join(items) -- cgit v1.2.3-54-g00ecf