Sort items in code generated using fypp

When doing package builds, the result would be not reproducible, with
differences in a few files following the same pattern:

   MODULE list_callstackentry
  -   USE timings_base_type, ONLY: callstack_entry_type, routine_stat_type, routine_report_type
  +   USE timings_base_type, ONLY: routine_stat_type, callstack_entry_type, routine_report_type

It seems that this comes from the use of a Python set to deduplicate items. The
order of items in a set is not stable, it is based on the hashes, which are
seeded randomly for each invocation of Python.

While at it, do not create an unnecessary list and do not use '_' as a variable
name. ('_' is used when the value is supposed to be ignored.)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2024-10-24 12:24:10 +02:00 committed by Ole Schütt
parent 16069d6911
commit dcb4acb79a
2 changed files with 2 additions and 2 deletions

View file

@ -31,7 +31,7 @@ REAL(${el1}$) < REAL(${el2}$) .OR. (ABS(REAL(${el1}$)-REAL(${el2}$)) < epsilon(M
#:def uselist(list_in)
#! comma-separated list of unique entries of list_in
$: ", ".join(list(set([_ for _ in list_in if _])))
$: ", ".join(sorted(set(x for x in list_in if x)))
#:enddef
#:endmute

View file

@ -16,7 +16,7 @@
#:def uselist(list_in)
#! comma-separated list of unique entries of list_in
$: ", ".join(list(set(list_in)))
$: ", ".join(sorted(set(list_in)))
#:enddef
#:def uselist_listmethods(t)