2021-10-05 06:44:07 +02:00
|
|
|
# Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
2021-06-15 14:46:59 +02:00
|
|
|
import os
|
2021-10-05 06:44:07 +02:00
|
|
|
import sys
|
2021-06-15 14:46:59 +02:00
|
|
|
|
|
|
|
qrc_file = os.path.abspath(sys.argv[1])
|
|
|
|
icons = sys.argv[2:]
|
|
|
|
|
|
|
|
file_skeleton = """
|
|
|
|
<RCC>
|
|
|
|
<qresource prefix="/">
|
|
|
|
FILES
|
|
|
|
</qresource>
|
|
|
|
</RCC>
|
|
|
|
""".strip()
|
|
|
|
|
|
|
|
indent = " " * 8
|
|
|
|
lines = []
|
|
|
|
for icon in icons:
|
2021-10-05 06:44:07 +02:00
|
|
|
base = os.path.basename(icon)
|
2021-06-15 14:46:59 +02:00
|
|
|
path = os.path.relpath(icon, start=os.path.dirname(qrc_file))
|
2021-10-05 06:44:07 +02:00
|
|
|
line = f'{indent}<file alias="icons/{base}">{path}</file>'
|
2021-06-15 14:46:59 +02:00
|
|
|
lines.append(line)
|
|
|
|
|
|
|
|
with open(qrc_file, "w") as file:
|
|
|
|
file.write(file_skeleton.replace("FILES", "\n".join(lines)))
|