B.icon = imagePath # version of the extension B.version = '0.2.6' # should the extension be launched at start-up? B.launchAtStartUp = True # script to be executed when RF starts B.mainScript = 'hello.py' # does the extension contain html help files? B.html = True # minimum RoboFont version required for this extension B.requiresVersionMajor = '4' B.requiresVersionMinor = '0' # scripts which should appear in Extensions menu B.addToMenu = [{ 'path': 'doSomething.py', '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:
import os import shutil from mojo.extensions import ExtensionBundle lib_path = os.path.dirname(__file__) extension_file = 'MeasureHandles.roboFontExt' extension_path = os.path.join(os.path.join(lib_path, 'extension'), extension_file) # extension_html = os.path.join(lib_path, "_docs") extension_lib_path = os.path.join(extension_path, 'lib') print 'building extension...', B = ExtensionBundle() B.name = u"Measure Handles Tool" B.developer = u'Gustavo Ferreira, Johannes Breyer' B.developerURL = 'http://hipertipo.com/' B.version = "0.1" B.mainScript = "MeasureHandlesTool.py" B.launchAtStartUp = 1 B.addToMenu = [] B.requiresVersionMajor = '1' B.requiresVersionMinor = '5' B.infoDictionary["html"] = 0 B.infoDictionary["com.robofontmechanic.Mechanic"] = { "repository" : "johannesbreyer/HandleLength", "description" : "A tool to display length & angle of bezier handles in a glyph", } B.save(extension_path, libPath=lib_path, htmlPath=None, resourcesPath=None, pycOnly=False) print 'done.\n'
# build new extension print "\trebuilding the RoboFont extension..." B = ExtensionBundle() B.name = "RoboFab Docs" B.developer = "RoboFab Developers" B.developerURL = "http://robofab.org/" B.version = "0.1" B.mainScript = "" B.launchAtStartUp = 0 B.addToMenu = [{ "path": "docs.py", "preferredName": "RoboFab Docs", "shortKey": "", }] B.requiresVersionMajor = "1" B.requiresVersionMinor = "5" B.infoDictionary["html"] = 0 B.infoDictionary["com.robofontmechanic.Mechanic"] = { "repository": "roboDocs/roboFabDocs", "description": "The RoboFab Documentation as a RoboFont extension", } B.save(extensionPath, libPath=libPath, resourcesPath=None, pycOnly=False) # remove git repository from extension extensionLibPath = os.path.join(extensionPath, 'lib') if os.path.exists(extensionLibPath): # remove git repository gitPath = os.path.join(extensionLibPath, '.git') if os.path.exists(gitPath): print '\tremoving git repository from extension...'
licensePath = os.path.join(basePath, "license.txt") requirementsPath = os.path.join(basePath, "requirements.txt") extensionFile = "%s.roboFontExt" % name buildPath = os.path.join(basePath, "build") extensionPath = os.path.join(buildPath, extensionFile) B = ExtensionBundle() B.name = name B.developer = developer B.developerURL = developerURL B.version = version B.launchAtStartUp = False B.mainScript = "main.py" B.html = os.path.exists(os.path.join(sourcePath, "documentation", "index.html")) B.requiresVersionMajor = roboFontVersion.split(".")[0] B.requiresVersionMinor = roboFontVersion.split(".")[1] B.addToMenu = menuItems if os.path.exists(licensePath): with open(licensePath) as license: B.license = license.read() if os.path.exists(requirementsPath): with open(requirementsPath) as requirements: B.requirements = requirements.read() print("building extension...", end=" ") v = B.save(extensionPath, libPath=libPath, pycOnly=pycOnly) print("done!") print() print(B.validationErrors())
# build new extension print "\trebuilding the RoboFont extension..." B = ExtensionBundle() B.name = "RoboFab Docs" B.developer = "RoboFab Developers" B.developerURL = "http://robofab.org/" B.version = "0.1" B.mainScript = "" B.launchAtStartUp = 0 B.addToMenu = [{ "path" : "docs.py", "preferredName" : "RoboFab Docs", "shortKey" : "", }] B.requiresVersionMajor = "1" B.requiresVersionMinor = "5" B.infoDictionary["html"] = 0 B.infoDictionary["com.robofontmechanic.Mechanic"] = { "repository" : "roboDocs/roboFabDocs", "description" : "The RoboFab Documentation as a RoboFont extension", } B.save(extensionPath, libPath=libPath, resourcesPath=None, pycOnly=False) # remove git repository from extension extensionLibPath = os.path.join(extensionPath, 'lib') if os.path.exists(extensionLibPath): # remove git repository gitPath = os.path.join(extensionLibPath, '.git') if os.path.exists(gitPath): print '\tremoving git repository from extension...'