X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FPlugins%2Fnewplugin.py;h=32c7269d734dd5bd28ce9db228781a967c5f55b1;hp=6a448407c91e04abfe0c08a4565b61d6a078db8d;hb=bb86afd81b9da2d46d53e12318af3035b23ba787;hpb=2e7f8857586f196b5434e3ce9a41a604cbf08f29 diff --git a/lib/python/Plugins/newplugin.py b/lib/python/Plugins/newplugin.py old mode 100644 new mode 100755 index 6a44840..32c7269 --- a/lib/python/Plugins/newplugin.py +++ b/lib/python/Plugins/newplugin.py @@ -2,10 +2,12 @@ import os -name = raw_input("Plugin name: ") - +os.system("clear") +internalname = raw_input("Internal plugin name (no whitespaces, plugin directory): ") +name = raw_input("Visible plugin name: ") print +os.system("clear") dirlist = [] count = 0 print "Plugin categories:" @@ -31,7 +33,7 @@ def add_where_pluginmenu(name, fnc): wherelist = [] wherelist.append(("WHERE_EXTENSIONSMENU", add_where_extensionsmenu)) -wherelist.append(("WHERE_PLUGINMENU", add_where_extensionsmenu)) +wherelist.append(("WHERE_PLUGINMENU", add_where_pluginmenu)) targetlist = [] @@ -61,15 +63,46 @@ while not stop: targetlist.remove(wherelist[int(target) - 1]) -file = open("plugin.py", "w") +pluginpath = category + "/" + internalname +os.mkdir(pluginpath) + +makefile = open(category + "/Makefile.am", "r") +lines = makefile.readlines() +lines = ''.join(lines) +lines = lines.strip() +lines += " " + internalname +makefile.close() + +makefile = open(category + "/Makefile.am", "w") +makefile.write(lines) +makefile.close() + +lines = [] +print "open" +configure = open("../../../configure.ac", "r") +while True: + line = configure.readline() + if not line: + break + lines.append(line) + if line.strip() == "lib/python/Plugins/" + category + "/Makefile": + lines.append("lib/python/Plugins/" + pluginpath + "/Makefile\n") +configure.close() +print "close" + +configure = open("../../../configure.ac", "w") +configure.writelines(lines) +configure.close() + +file = open(pluginpath + "/plugin.py", "w") importlist = [] for where in targetlist: importlist.append(where[0]) file.write("""from Screens.Screen import Screen -from Plugins.Plugin import PluginDescriptor, %s -""" % ', '.join(importlist)) +from Plugins.Plugin import PluginDescriptor +""") mainlist = [] for count in range(len(targetlist)): @@ -101,4 +134,13 @@ def Plugins(**kwargs): return %s """ % descriptorlist) -file.close() \ No newline at end of file +file.close() + +makefile = open(pluginpath + "/Makefile.am", "w") +makefile.write("""installdir = $(pkglibdir)/python/Plugins/%s/%s + +install_PYTHON = \\ + __init__.py \\ + plugin.py +""" % (category, internalname)) +makefile.close()