parameters: (plugin, ctx, project=None)
return_statement: return plugin
docstring: Parses plugin definition into normalized object
docstring_summary: Parses plugin definition into normalized object
docstring_tokens: Parses plugin definition into normalized object
function: def parse_plugin_def(plugin, ctx, project=None):
  	"Parses plugin definition into normalized object"
  	if isstr(plugin):
  		plugin = json.loads(plugin)
  	
  	plugin_file = os.path.join('%s.js' % plugin['pluginId'])
  	paths = []
  
  	project_path = None
  	if project and project['id'] != 'empty':
  		project_path = os.path.dirname(project['id'])
  
  	# look for plugin by specified path
  	if 'pluginPath' in plugin:
  		if project_path:
  			paths.append(os.path.join(project_path, plugin['pluginPath']))
  		else:
  			paths.append(plugin['pluginPath'])
  
  	# look for local plugin
  	paths.append('plugin')
  
  	# look for plugin in project
  	if project_path:
  		paths.append(project_path)
  
  	plugin['pluginPath'] = [os.path.join(p, plugin_file) for p in paths]
  
  	# try to find plugin
  	# for p in paths:
  	# 	try:
  	# 		plugin_path = os.path.join(p, plugin_file)
  	# 		ctx.eval_js_file(plugin_path, True)
  	# 		plugin['pluginPath'] = plugin_path
  	# 		break
  	# 	except Exception as e:
  	# 		continue
  
  	return plugin
function_tokens: def parse_plugin_def ( plugin , ctx , project = None ) : if isstr ( plugin ) : plugin = json . loads ( plugin ) plugin_file = os . path . join ( '%s.js' % plugin [ 'pluginId' ] ) paths = [ ] project_path = None if project and project [ 'id' ] != 'empty' : project_path = os . path . dirname ( project [ 'id' ] ) # look for plugin by specified path if 'pluginPath' in plugin : if project_path : paths . append ( os . path . join ( project_path , plugin [ 'pluginPath' ] ) ) else : paths . append ( plugin [ 'pluginPath' ] ) # look for local plugin paths . append ( 'plugin' ) # look for plugin in project if project_path : paths . append ( project_path ) plugin [ 'pluginPath' ] = [ os . path . join ( p , plugin_file ) for p in paths ] # try to find plugin # for p in paths: # 	try: # 		plugin_path = os.path.join(p, plugin_file) # 		ctx.eval_js_file(plugin_path, True) # 		plugin['pluginPath'] = plugin_path # 		break # 	except Exception as e: # 		continue return plugin