File: wb_dev_utils_grt.py

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (47 lines) | stat: -rw-r--r-- 1,272 bytes parent folder | download | duplicates (3)
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
#  Copyright (c) 2011 Oracle and/or its associated. All rights reserved.
#

import subprocess
import os

# import the wb module
from wb import *
# import the grt module
import grt

import mforms

# define this Python module as a GRT module
ModuleInfo = DefineModule(name= "WbDevUtil", author= "Oracle.", version="1.0")


@ModuleInfo.export(grt.INT, grt.STRING, grt.STRING)
def generateManifest(moduleName, outpath):
    module = getattr(grt.modules, moduleName, None)
    if not module:
        raise ValueError("Invalid module name")

    dict = grt.Dict()

    dict["name"] = module.__name__
    dict["iconFile"] = os.path.basename(module.__iconpath__)
    pluginList = grt.List()
    dict["plugins"] = pluginList
    dict["author"] = module.__author__
    dict["description"] = module.__description__
    dict["version"] = module.__version__

    if not hasattr(module, "getPluginInfo"):
        raise ValueError("Module '%s' is not a plugin module" % moduleName)
    
    plugins = module.getPluginInfo()
    for plugin in plugins:
        entry = grt.Dict()
        entry["name"] = plugin.name
        entry["caption"] = plugin.caption
        entry["description"] = plugin.description
        pluginList.append(entry)

    grt.serialize(dict, outpath)

    return 0