This repository was archived by the owner on Feb 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathbuild.py
66 lines (56 loc) · 2.13 KB
/
build.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
## INFO ##
## INFO ##
# Import python modules
from os.path import join
# Module level constants
CURRENT_DIR = '.'
LANG_PATH = join(CURRENT_DIR, 'langs')
THEME_PATH = join(CURRENT_DIR, 'themes')
LOCAL_PATH = join('~', '.config', 'sublime-text-3', 'Packages', 'User')
# Import tmtools modules
try:
from tmtools.convert import Language, Theme
except ImportError:
from sys import exit
print('[ ERROR ] tmtools modules are missing: '
'install it from http://github.com/petervaro/tmtools')
exit(-1)
#------------------------------------------------------------------------------#
# Import user modules
from src.python import syntax as py_syntax
from src.cython import syntax as cy_syntax
from src.gloom import style as gl_style
# I/O Details of languages and themes
py_details = {'name' : 'Python3',
'path' : LANG_PATH,
'scope': 'python.3',
'comments' : {'line_comments': ('#',)},
'test_name': 'Python3_TEST',
'test_path': join(LOCAL_PATH, 'Python3_TEST')}
cy_details = {'name' : 'Cython',
'path' : LANG_PATH,
'scope': 'cython',
'comments' : {'line_comments': ('#',)},
'test_name': 'Cython_TEST',
'test_path': join(LOCAL_PATH, 'Cython_TEST')}
gl_details = {'name': 'Gloom',
'path': THEME_PATH,
'test_name': 'Gloom_TEST',
'test_path': join(LOCAL_PATH, 'Gloom_TEST')}
# NOTE: Old path to theme files => DO NOT SUPPORT IT:
# '~/Library/Application Support/Sublime Text 3/Packages/Color Scheme - Default'
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Process language files
for details, syntax in zip((py_details, cy_details), (py_syntax, cy_syntax)):
# Setup names and locations
lang = Language(**details)
# Convert and save language file
lang.from_dict(syntax)
lang.write()
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Setup names and locations
theme = Theme(**gl_details)
# Convert and save theme file
theme.from_dict(gl_style)
theme.write()