forked from mail-ru-im/im-desktop
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupdate_release_notes.py
42 lines (30 loc) · 1.01 KB
/
update_release_notes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
import os
script_path = os.path.dirname(os.path.realpath(__file__))
release_notes_source_path = os.path.join(script_path, '../gui/main_window/ReleaseNotesText.h')
release_notes_text_path = os.path.join(script_path, '../RELEASE_NOTES')
placeholder_str = '%PLACEHOLDER%'
release_notes_source_content = \
"""
#pragma once
/* AUTOGENERATED FILE */
namespace Ui
{
namespace ReleaseNotes
{
QString releaseNotesText()
{
return QT_TRANSLATE_NOOP("release_notes",
" """ + placeholder_str + """ ");
}
}
}
"""
with open(release_notes_text_path, 'r') as text_file:
release_notes_text = text_file.read()
release_notes_text = release_notes_text.replace('\r\n', '\\n ')
release_notes_text = release_notes_text.replace('\n', '\\n ')
release_notes_text = release_notes_text.replace('"', '\\"')
release_notes_source_content = release_notes_source_content.replace(placeholder_str, release_notes_text)
with open(release_notes_source_path, 'w') as source_file:
source_file.write(release_notes_source_content)