Debian Codegraph @

tools/fdroid_create_fastlane_changelogs.py

raw symbols SCIP
1 #!/usr/bin/python3
2 #
3 # GCompris - fdroid_create_fastlane_changelogs.py
4 #
5 # SPDX-FileCopyrightText: 2024 Johnny Jazeix <[email protected]>
6 #
7 # SPDX-License-Identifier: GPL-3.0-or-later
8
9 import sys
10 import yaml
11
12 from packaging import version
13 import os
14
15 def main(argv):
16 if not os.path.exists(argv[0]):
17 print("Needs to be run from top level of Li-Ri")
18 sys.exit(1)
19
20 with open("NEWS.yaml", "r", encoding="utf8") as stream:
21 for news in yaml.safe_load_all(stream):
22 short_version = version.Version(news['Version'])
23 if short_version.major < 3: # Don't create changelog for old versions not in Android
24 continue
25 if 'Description' in news:
26 long_version = short_version.major*10000+short_version.minor*100+short_version.micro
27 print(long_version, news['Description'])
28 out_file = f"fastlane/metadata/android/en-US/changelogs/{long_version}.txt"
29 with open(out_file, 'w', encoding="utf8") as changelog_file:
30 changelog_file.write('\n'.join(news['Description']) + '\n')
31
32
33 if __name__ == '__main__':
34 main(sys.argv)