-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate-sources
executable file
·36 lines (29 loc) · 1.19 KB
/
generate-sources
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
#!/usr/bin/env python3
import json
import os
import subprocess
if __name__ == "__main__":
root = os.path.dirname(__file__)
generated_sources_path = f'{root}/generated-sources.json'
subprocess.call([
'python3',
f'{root}/flatpak-builder-tools/node/flatpak-node-generator.py',
'--electron-node-headers',
'--node-chromedriver-from-electron',
'9.3.1',
'yarn', '-r', f'{root}/desktop/yarn.lock',
'-R', 'yarn.lock', '-R', 'app/yarn.lock',
], cwd=root)
with open(generated_sources_path, 'r') as fp:
generated_sources = json.load(fp)
# Move electron-cache files to match what @electron/get expects
# https://github.com/electron/get/blob/master/src/Cache.ts
for source in generated_sources:
if source['dest'] == 'flatpak-node/electron-cache':
cache_dir = source['url'] \
.split('?')[0].split('#')[0] \
.translate(str.maketrans('', '', '<>:"/\\|?*'))[:255]
source['dest'] = f'flatpak-node/electron-cache/{cache_dir}'
del source['dest-filename']
with open(generated_sources_path, 'w') as fp:
json.dump(generated_sources, fp, indent=4)