a/trunk/cforge/cforge/Package/CFORGE/Scripts/action.svn.checkout.py | b/trunk/cforge/cforge/Package/CFORGE/Scripts/action.svn.checkout.py | ||
---|---|---|---|
... |
... |
||
7 | 7 | ||
8 | import sys |
8 | import sys |
9 | import os.path |
9 | import os.path |
10 | import pysvn |
10 | import pysvn |
11 | 11 | ||
12 | system.prompt_handling = PromptHandling.None |
||
13 | |||
12 | if len(sys.argv) <= 1: |
14 | if len(sys.argv) <= 1: |
13 | print("usage: <url> [<user> <pass> <working dir>]") |
15 | print("usage: <url> [<user> <pass> <working dir>]") |
14 | sys.exit() |
16 | sys.exit() |
15 | 17 | ||
16 | url = sys.argv[1].replace("`````", "'") |
18 | url = sys.argv[1].replace("`````", "'") |
... |
... |
||
34 | req.save = True # Optional |
36 | req.save = True # Optional |
35 | 37 | ||
36 | # checkout plain SVN files |
38 | # checkout plain SVN files |
37 | pysvn.svn_checkout_non_codesys(username, password, url, path) |
39 | pysvn.svn_checkout_non_codesys(username, password, url, path) |
38 | 40 | ||
39 | try: |
41 | # get all CODESYS projects |
40 | # get all CODESYS projects |
||
41 | svn.auth_username_password += set_username |
42 | svn.auth_username_password += set_username |
42 | cdsprojects = pysvn.svn_get_directories_with_codesys_projects(username, password, url) |
43 | cdsprojects = pysvn.svn_get_directories_with_codesys_projects(username, password, url) |
43 | # checkout all CODESYS projects |
44 | # checkout all CODESYS projects |
44 | for p in cdsprojects: |
45 | for p in cdsprojects: |
45 | dirbase = path + "\\" + p.rstrip('/').replace("/", "\\") |
46 | dirbase = path + "\\" + p.rstrip('/').replace("/", "\\") |
46 | filebase = os.path.basename(dirbase) |
47 | filebase = os.path.basename(dirbase) |
47 | dir = os.path.dirname(dirbase) |
48 | dir = os.path.dirname(dirbase) |
48 | svn.checkout(url + "/" + p, dir, filebase + ".library") |
49 | print("checkout via SVN...") |
50 | try: |
||
51 | svn.checkout(url + "/" + p, dir, filebase + ".library") |
||
52 | except: |
||
53 | pass |
||
54 | print("... checkout done.") |
||
55 | |||
56 | print("save project...") |
||
49 | proj = projects.primary |
57 | proj = projects.primary |
50 | if proj.find("Project Information"): |
58 | if proj.find("Project Information"): |
51 | proj.save_as(dirbase + ".library") |
59 | proj.save_as(dirbase + ".library") |
52 | else: |
60 | else: |
53 | proj.save_as(dirbase + ".project") |
61 | proj.save_as(dirbase + ".project") |
54 | proj.close() |
62 | print("... project saved.") |
55 | except: |
||
56 | print ("Seems like the CODESYS SVN package is missing. Checked out only plain files and no CODESYS projects.") |
63 | print("closing...") |
64 | try: |
||
65 | proj.close() |
||
66 | except: |
||
67 | pass |
||
57 | print ("Exception cause: %s" % str(sys.exc_info())) |
68 | print("... project closed.") |
58 | pass |
69 | |
59 | 70 | ||
60 | system.exit() |
71 | system.exit() |