]>
git.ipfire.org Git - thirdparty/pdns.git/blob - build-scripts/test-sources-sorted.py
6 REGEX
= re
.compile(r
'(?s)[a-z0-9][a-z0-9_]+_SOURCES ?= ?\\.*?^$', re
.MULTILINE
)
9 def test_sources(fname
) -> int:
11 with
open(fname
, mode
="r") as f
:
14 matches
= re
.findall(REGEX
, text
)
17 lines
= match
.split(" \\\n\t")
18 elem
= lines
[0].rstrip(' =')
20 sorted_lines
= sorted(lines
)
22 if sorted_lines
!= lines
:
24 print(f
'Source files for {elem} in {fname} is not sorted properly'
25 .format(elem
=elem
, fname
=fname
))
29 if __name__
== "__main__":
30 sys
.exit(test_sources(sys
.argv
[1]))