-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
59 lines (49 loc) · 1.63 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
import os, shutil
from mojo.extensions import ExtensionBundle
basePath = os.path.dirname(__file__)
sourcePath = os.path.join(basePath, 'source')
libPath = os.path.join(sourcePath, 'code')
htmlPath = os.path.join(sourcePath, 'docs')
resourcesPath = None
licensePath = os.path.join(basePath, 'LICENSE')
pycOnly = False
extensionFile = 'groupSpacing.roboFontExt'
extensionPath = os.path.join(basePath, extensionFile)
# extension settings
B = ExtensionBundle()
B.name = "GroupSpacing"
B.developer = 'Gustavo Ferreira'
B.developerURL = 'http://hipertipo.com'
B.icon = os.path.join(basePath, 'icon.png')
B.version = '0.3.2'
B.launchAtStartUp = False
B.mainScript = ''
B.html = True
B.requiresVersionMajor = '3'
B.requiresVersionMinor = '2'
B.addToMenu = [
{
'path' : 'groupSpacing.py',
'preferredName' : 'GroupSpacing',
'shortKey' : '',
},
]
with open(licensePath) as license:
B.license = license.read()
# copy README & imgs to extension docs
shutil.copyfile(os.path.join(basePath, 'README.md'), os.path.join(htmlPath, 'index.md'))
imgsFolder = os.path.join(basePath, 'imgs')
htmlImgsFolder = os.path.join(htmlPath, 'imgs')
if not os.path.exists(htmlImgsFolder):
os.makedirs(htmlImgsFolder)
for f in os.listdir(imgsFolder):
if not os.path.splitext(f)[-1] in ['.png', '.jpg', '.jpeg']:
continue
imgPath = os.path.join(imgsFolder, f)
shutil.copy2(imgPath, htmlImgsFolder)
# build extension package
print('building extension...', end=' ')
B.save(extensionPath, libPath=libPath, htmlPath=htmlPath, resourcesPath=resourcesPath, pycOnly=pycOnly)
print('done!')
print()
print(B.validationErrors())