--- a +++ b/trunk/cforge/cforge/Package/CFORGE/Scripts/install.py @@ -0,0 +1,50 @@ +# imports +import sys + + +from System.Diagnostics import Process +from System.Diagnostics import Debugger +from System.IO import Path +from System.Net import WebClient + +#Debugger.Break() +# +# This is a cforge command (script file) +# this will be run as ironpython script. +# the filename of this script is automatically the corresponding cforge command +# with some magic functions you can easily integrate it nicely into cforge tool + +# cforge_usage: +# here you can return an array of all possible arguments and options that can +# be passed to this command script +def cforge_usage(): + help = [ + ["<url_to_package>", "download and install a codesys package"], + ["<local path of package>", "install a local codesys package"] + ] + + return help + + + +print("command install running") +print("Arguments: " + str(len(sys.argv))) +for a in sys.argv: + print(a) + + +# download + +localpath = Path.GetFilename(sys.argv[0]) +url = sys.argv[0] + +web_client = WebClient() +web_client.DownloadFile(url, localpath) + + +# and install local package now: +Process.Start(localpath) + + + +