a | b/trunk/scripts/action.svn.checkout.py | ||
---|---|---|---|
1 | # Example Batch: |
||
2 | # set WD=%~d0%~p0 |
||
3 | # set USER=<username> |
||
4 | # set PASS=<password> |
||
5 | # set URL=https://forge.codesys.com/svn/drv,gpio-mod,code/trunk/GPIOMods |
||
6 | # "C:\Program Files (x86)\3S CODESYS-V3.5.12.0\CODESYS\Common\CODESYS.exe" --profile="CODESYS V3.5 SP12" --runscript="%WD%\action.svn.checkout.py" --scriptargs="%USER% %PASS% %URL% %WD%" --noUI |
||
7 | |||
8 | import sys |
||
9 | import os.path |
||
10 | |||
11 | username=sys.argv[1] |
||
12 | password=sys.argv[2] |
||
13 | url=sys.argv[3] |
||
14 | path=sys.argv[4] |
||
15 | parts=os.path.basename(url).split(".") |
||
16 | filebase=(parts[-1] if parts[-1] != "" else parts[-2]) |
||
17 | |||
18 | def set_username(req): |
||
19 | print_all(req) |
||
20 | req.username = username |
||
21 | req.password = password |
||
22 | req.save = True # Optional |
||
23 | |||
24 | svn.auth_username_password += set_username |
||
25 | |||
26 | # checkout as a library |
||
27 | svn.checkout(url, path, filebase + ".library") |
||
28 | |||
29 | # save as a library if, we find a "Project Information" |
||
30 | # otherwhise we asume, that this is a project file |
||
31 | proj = projects.primary |
||
32 | if proj.find("Project Information"): |
||
33 | proj.save_as(path + '\\' + filebase + ".library") |
||
34 | else: |
||
35 | proj.save_as(path + '\\' + filebase + ".project") |