forked from DeachSword/CHRLINE-Thrift
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.py
More file actions
47 lines (41 loc) · 1.45 KB
/
init.py
File metadata and controls
47 lines (41 loc) · 1.45 KB
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
43
44
45
46
47
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
THIS IS A IMPLE EXAMPLE FOR DISCORD GROUP.
REFS TO:
https://discord.com/channels/466066749440393216/891368193002725426/1129378302742773820
Versoin: 0.0.1
Auther: YinMo0913
'''
import subprocess
files = [
r'./subs/Types.thrift',
r'./subs/Exceptions.thrift',
r'./subs/TalkService/ttypes.thrift',
r'./subs/TalkService/TalkService.thrift',
r'./subs/E2EEKeyBackupService.thrift',
r'./subs/AccessTokenRefreshService.thrift',
r'./subs/BuddyService.thrift',
r'./subs/CallService.thrift',
r'./subs/SyncService.thrift',
r'./subs/HomeSafetyCheckService/ttypes.thrift',
r'./subs/HomeSafetyCheckService/HomeSafetyCheckService.thrift',
r'./subs/SquareService/ttypes.thrift',
r'./subs/SquareService/SquareService.thrift',
r'./subs/SquareLiveTalkService/ttypes.thrift',
r'./subs/SquareLiveTalkService/SquareLiveTalkService.thrift',
r'./subs/SecondaryQrCodeLoginService/ttypes.thrift',
r'./subs/SecondaryQrCodeLoginService/SecondaryQrCodeLoginService.thrift',
]
cache_file = r'./CHRLINE_ALL.thrift'
content = ''
for file in files:
with open(file) as f:
data = f.read().splitlines(keepends=True)
raw = ''
for d in data:
if not d.startswith('include'):
raw += d
content += f'\n\n{raw}'
open(cache_file, 'w+').write(content)
subprocess.run(["thrift", f"--gen", "py", "CHRLINE_ALL.thrift"])