2019-09-08 22:27:57 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
filename = 'chatterino.pro'
|
|
|
|
data = ""
|
|
|
|
|
|
|
|
with open(filename, 'r') as project:
|
|
|
|
data = project.read()
|
2019-09-12 16:36:52 +02:00
|
|
|
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)
|
2019-09-08 22:27:57 +02:00
|
|
|
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)
|
|
|
|
|
2019-09-12 16:36:52 +02:00
|
|
|
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)
|
2019-09-08 22:27:57 +02:00
|
|
|
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)
|
|
|
|
|
|
|
|
with open(filename, 'w') as project:
|
|
|
|
project.write(data)
|
|
|
|
|