-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_file_format.py
48 lines (38 loc) · 1.07 KB
/
update_file_format.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
43
44
45
46
47
48
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
DATA_ROOT = os.path.dirname(os.path.realpath(__file__))
CLI_EXECUTABLE = sys.argv[1]
def find(suffix):
result = []
for root, dirnames, filenames in os.walk(DATA_ROOT):
if root.endswith(suffix):
result.append(root)
for filename in filenames:
if filename.endswith(suffix):
result.append(os.path.join(root, filename))
return set(result)
def update_libraries():
for library in find('.lplib'):
subprocess.check_call([
CLI_EXECUTABLE,
'open-library',
'--all',
'--save',
library,
])
def update_projects():
for project in find('.lpp'):
subprocess.check_call([
CLI_EXECUTABLE,
'open-project',
'--save',
project,
])
if __name__ == "__main__":
os.environ['LIBREPCB_DISABLE_UNSTABLE_WARNING'] = '1'
os.environ['LIBREPCB_UPGRADE_UNSTABLE'] = '1'
update_libraries()
update_projects()