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