-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink_assets_for_development.py
More file actions
executable file
·36 lines (31 loc) · 1.38 KB
/
link_assets_for_development.py
File metadata and controls
executable file
·36 lines (31 loc) · 1.38 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
#!/usr/bin/env python3
import sys
import os
try:
import ictv.renderer
renderer_path = ictv.renderer.__path__[0]
except (TypeError, ImportError):
print('ICTV core could not be found, aborting')
sys.exit(-1)
remove = len(sys.argv) > 1
parent_dir = os.path.dirname(os.path.abspath(__file__))
themes_dir = os.path.join(parent_dir, 'ictv', 'renderer', 'themes')
templates_dir = os.path.join(parent_dir, 'ictv', 'renderer', 'templates')
if os.path.exists(themes_dir):
for theme in filter(lambda t: not t.startswith('.'), os.listdir(themes_dir)):
link = os.path.join(renderer_path, 'themes', theme)
if not remove and not os.path.exists(link):
os.symlink(os.path.join(themes_dir, theme), link, target_is_directory=True)
print('Installed theme ' + theme)
elif remove and os.path.exists(link):
os.unlink(link)
print('Removed theme ' + theme)
if os.path.exists(templates_dir):
for template in filter(lambda t: not t.startswith('.'), os.listdir(templates_dir)):
link = os.path.join(renderer_path, 'templates', template)
if not remove and not os.path.exists(link):
os.symlink(os.path.join(templates_dir, template), link)
print('Installed template ' + template)
elif remove and os.path.exists(link):
os.unlink(link)
print('Removed template ' + template)