예제 #1
0
B.html = haveDocumentation
B.requiresVersionMajor = roboFontVersion.split(".")[0]
B.requiresVersionMinor = roboFontVersion.split(".")[1]
B.addToMenu = menuItems
with open(licensePath) as license:
    B.license = license.read()
with open(requirementsPath) as requirements:
    B.requirements = requirements.read()
print("Building extension...", end=" ")
v = B.save(extensionPath,
           libPath=libPath,
           pycOnly=pycOnly,
           htmlPath=docPath,
           resourcesPath=resourcesPath)
print("done!")
errors = B.validationErrors()
if errors:
    print("Uh oh! There were errors:")
    print(errors)

# Install the extension.

if installAfterBuild:
    print("Installing extension...", end=" ")
    installDirectory = os.path.expanduser(
        "~/Library/Application Support/RoboFont/plugins")
    installPath = os.path.join(installDirectory, extensionFile)
    if os.path.exists(installPath):
        shutil.rmtree(installPath)
    shutil.copytree(extensionPath, installPath)
    print("done!")
예제 #2
0
    'preferredName': 'do something',
    'shortKey': (NSCommandKeyMask | NSShiftKeyMask, 'b'),
}, {
    'path': 'doSomethingElse.py',
    'preferredName': 'do something else',
    'shortKey': (NSAlternateKeyMask, 'o'),
}]

# license for the extension
with open(licensePath) as license:
    B.license = license.read()

# required extensions
with open(requirementsPath) as requirements:
    B.requirements = requirements.read()

# expiration date for trial extensions
B.expireDate = '2020-12-31'

# compile and save the extension bundle
print('building extension...', end=' ')
B.save(extensionPath,
       libPath=libPath,
       htmlPath=htmlPath,
       resourcesPath=resourcesPath)
print('done!')

# check for problems in the compiled extension
print()
print(B.validationErrors())
B.requiresVersionMinor = '5'
B.addToMenu = [
    {
        'path'         : 'glyphConstructionUI.py',
        'preferredName': 'Glyph Builder',
        'shortKey'     : '',
    },
]

with codecs.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
# ---------------

print('building extension...', end=" ")
B.save(extensionPath, libPath=libPath, htmlPath=htmlPath)

print('copy module...', end=" ")
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())