From 754f5c968ad1dff3ae7f602d23baac1299731062 Mon Sep 17 00:00:00 2001 From: Leon Richardt Date: Thu, 12 Sep 2019 16:36:52 +0200 Subject: [PATCH] Sort file list before writing to project file Now using the built-in Python `list.sort` method to sort files. This should ensure consistent behavior on all systems and prevent unnecessary merge conflicts. --- update_filelist.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/update_filelist.py b/update_filelist.py index 2e3741b62..967c2a4dc 100644 --- a/update_filelist.py +++ b/update_filelist.py @@ -10,12 +10,16 @@ data = "" with open(filename, 'r') as project: data = project.read() - sources = subprocess.getoutput("find ./src -type f -regex '.*\.cpp' | sed 's_\./_ _g'") + sources_list = subprocess.getoutput("find ./src -type f -regex '.*\.cpp' | sed 's_\./_ _g'").splitlines() + sources_list.sort(key=str.lower) + sources = "\n".join(sources_list) sources = re.sub(r'$', r' \\\\', sources, flags=re.MULTILINE) sources += "\n" data = re.sub(r'^SOURCES(.|\r|\n)*?^$', 'SOURCES += \\\n' + sources, data, flags=re.MULTILINE) - headers = subprocess.getoutput("find ./src -type f -regex '.*\.hpp' | sed 's_\./_ _g'") + headers_list = subprocess.getoutput("find ./src -type f -regex '.*\.hpp' | sed 's_\./_ _g'").splitlines() + headers_list.sort(key=str.lower) + headers = "\n".join(headers_list) headers = re.sub(r'$', r' \\\\', headers, flags=re.MULTILINE) headers += "\n" data = re.sub(r'^HEADERS(.|\r|\n)*?^$', 'HEADERS += \\\n' + headers, data, flags=re.MULTILINE)