-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
50 lines (46 loc) · 1.94 KB
/
tasks.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
#
# @copyright 2008-2020 Krizalys. All rights reserved.
# @link http://www.krizalys.com/
#
#
# IMPORTANT: This script requires Python 3.4 or newer.
#
from invoke import task
import plistlib
import yaml
#
# The build task converts all YAML files from the src directory into property
# list files in the root directory.
#
# NOTE: Although this does not matter from Sublime Text, Python does not
# guarantee that the order of the XML elements in the tmLanguage files will be
# the same upon each generation. This may affect the list of changed files while
# committing to the Git repository and should be handled wisely.
#
@task
def build():
files = {
"ebuild.tmLanguage": "ebuild.yml",
"package-accept-restrict.tmLanguage": "package-accept-restrict.yml",
"package-bashrc.tmLanguage": "package-bashrc.yml",
"package-env.tmLanguage": "package-env.yml",
"package-keywords.tmLanguage": "package-keywords.yml",
"package-license.tmLanguage": "package-license.yml",
"package-mask.tmLanguage": "package-mask.yml",
"package-properties.tmLanguage": "package-properties.yml",
"package-provided.tmLanguage": "package-provided.yml",
"package-unmask.tmLanguage": "package-unmask.yml",
"package-use.tmLanguage": "package-use.yml",
"package-use-force.tmLanguage": "package-use-force.yml",
"package-use-mask.tmLanguage": "package-use-mask.yml",
"packages.tmLanguage": "packages.yml",
"profile-bashrc.tmLanguage": "profile-bashrc.yml",
"use.tmLanguage": "use.yml"
}
for dest, src in files.items():
src = open("src/" + src)
dest = open(dest, "wb")
syntax = yaml.safe_load(src)
plistlib.dump(syntax, dest, sort_keys = False)
dest.close()
src.close()