MCPcopy Create free account
hub / github.com/Image-Py/imagepy / build_plugins

Function build_plugins

imagepy/core/loader/loader.py:93–122  ·  view source on GitHub ↗
(path, err=False)

Source from the content-addressed store, hash-verified

91 return rst
92
93def build_plugins(path, err=False):
94 root = err in (True, False)
95 if root: sta, err = err, []
96 subtree = []
97 cont = os.listdir(os.path.join(root_dir, path))
98 for i in cont:
99 subp = os.path.join(path,i)
100 if os.path.isdir(os.path.join(root_dir, subp)):
101 sub = build_plugins(subp, err)
102 if len(sub)!=0:subtree.append(sub)
103 elif i[-6:] in ('plg.py', 'lgs.py', 'wgt.py', 'gts.py'):
104 subtree.append(i)
105 elif i[-3:] in ('.mc', '.md', '.wf', 'rpt'):
106 subtree.append(i)
107 if len(subtree)==0:return []
108
109 rpath = path.replace('/', '.').replace('\\','.')
110 #rpath = rpath[rpath.index('imagepy.'):]
111 pg = __import__('imagepy.'+rpath,'','',[''])
112 pg.title = os.path.basename(path)
113 if hasattr(pg, 'catlog'):
114 if 'Personal Information' in pg.catlog:
115 print(subtree)
116 subtree = sort_plugins(pg.catlog, subtree)
117 subtree = extend_plugins(path, subtree, err)
118
119 if root and sta and len(err)>0:
120 IPy.write('Some plugin may be not loaded, but not affect others!')
121 for i in err: IPy.write('>>> %-50s%-20s%s'%i)
122 return (pg, subtree)
123
124def extend_tools(path, lst, err):
125 rst = []

Callers

nothing calls this directly

Calls 4

sort_pluginsFunction · 0.85
extend_pluginsFunction · 0.85
appendMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected