From aab1b4ef7b0f8ef7ba6fc5c48974f02c42d71add Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Tue, 3 Jan 2012 12:54:21 -0500 Subject: [PATCH] bug 714347 - pymake sort function should remove duplicates. r=khuey --HG-- extra : rebase_source : 0a39a2a1578856f7c9c15b4e43b58961dc8088a7 --- build/pymake/pymake/functions.py | 5 ++--- build/pymake/tests/sort.mk | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 build/pymake/tests/sort.mk diff --git a/build/pymake/pymake/functions.py b/build/pymake/pymake/functions.py index 32ec0eb727b4..9a60deacbc9f 100644 --- a/build/pymake/pymake/functions.py +++ b/build/pymake/pymake/functions.py @@ -193,9 +193,8 @@ class SortFunction(Function): __slots__ = Function.__slots__ def resolve(self, makefile, variables, fd, setting): - d = list(self._arguments[0].resolvesplit(makefile, variables, setting)) - d.sort() - util.joiniter(fd, d) + d = set(self._arguments[0].resolvesplit(makefile, variables, setting)) + util.joiniter(fd, sorted(d)) class WordFunction(Function): name = 'word' diff --git a/build/pymake/tests/sort.mk b/build/pymake/tests/sort.mk new file mode 100644 index 000000000000..e1313ad5cacb --- /dev/null +++ b/build/pymake/tests/sort.mk @@ -0,0 +1,4 @@ +# sort should remove duplicates +all: + @test "$(sort x a y b z c a z b x c y)" = "a b c x y z" + @echo "TEST-PASS"