a | b/trunk/cforge/cforge/Package/CFORGE/Scripts/update.py | ||
---|---|---|---|
1 | import sys, os |
||
2 | import cds_script |
||
3 | import ui |
||
4 | |||
5 | |||
6 | # This is a cforge command (script file) |
||
7 | # this will be run as ironpython script. |
||
8 | # the filename of this script is automatically the corresponding cforge command |
||
9 | # with some magic functions you can easily integrate it nicely into cforge tool |
||
10 | |||
11 | # cforge_usage: |
||
12 | # here you can return an array of all possible arguments and options that can |
||
13 | # be passed to this command script |
||
14 | def cforge_usage(): |
||
15 | help = [ |
||
16 | ["<path to CODESYS project>", "---"] |
||
17 | ] |
||
18 | |||
19 | return help |
||
20 | |||
21 | if len(sys.argv) <= 1: |
||
22 | print("Oh, there are no arguments. Perhaps you forgot something?") |
||
23 | sys.exit() |
||
24 | |||
25 | folder = sys.argv[1] |
||
26 | config = ui.Dialog("Update", Credentials=True) |
||
27 | |||
28 | if config != None: |
||
29 | scriptpath = os.path.abspath(os.path.dirname(sys.argv[0])) |
||
30 | scriptname = os.path.join(scriptpath, "action.svn.update.py") |
||
31 | scriptargs = "%s %s %s" % (config["user"], config["pass"], folder) |
||
32 | |||
33 | cds_script.RunCodesysWithScript(scriptname, scriptargs, False) |