-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild-extension.py
67 lines (56 loc) · 1.76 KB
/
build-extension.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
67
'''
build RoboFont Extension
Run inside RoboFont
'''
import os
import shutil
from mojo.extensions import ExtensionBundle
# ----------
# paths etc.
# ----------
basePath = os.path.dirname(__file__)
libPath = os.path.join(basePath, 'LibExtension')
htmlPath = os.path.join(basePath, 'html')
licensePath = os.path.join(basePath, 'LICENSE')
readmePath = os.path.join(basePath, 'README.md')
extensionPath = os.path.join(basePath, 'GlyphConstruction.roboFontExt')
modulePath = os.path.join(basePath, "Lib", "glyphConstruction.py")
# ----------------
# create extension
# ----------------
B = ExtensionBundle()
B.name = "Glyph Construction"
B.developer = 'Frederk Berlaen'
B.developerURL = 'http://typemytype.com/'
B.version = '0.17'
B.launchAtStartUp = True
B.mainScript = 'glyphConstructionUIStartUp.py'
B.html = True
B.requiresVersionMajor = '1'
B.requiresVersionMinor = '5'
B.addToMenu = [
{
'path' : 'glyphConstructionUIMenu.py',
'preferredName': 'Glyph Builder',
'shortKey' : '',
},
]
with open(licensePath, mode="r", encoding="utf-8") as f:
B.license = f.read()
B.repositoryURL = 'http://github.com/typemytype/GlyphConstruction/'
B.summary = 'A simple, human-readable, powerful language for describing how shapes are constructed.'
# ---------------
# build extension
# ---------------
# copy README file into 'html' folder as 'index.md'
shutil.copyfile(readmePath, os.path.join(htmlPath, 'index.md'))
print('building extension...')
B.save(extensionPath, libPath=libPath, htmlPath=htmlPath)
print('copying module...')
destModulePath = os.path.join(B.libPath(), "glyphConstruction.py")
if os.path.exists(destModulePath):
os.path.remove(destModulePath)
shutil.copy(modulePath, destModulePath)
print('...done!')
print()
print(B.validationErrors())