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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | import sys, os # this script helps to import a given project or library into codesys forge # it can be called via cforge, but also directly from inside codesys (for now this is experimental!) def cforge_usage(): help = [ ["<path to CODESYS project>", "---"] ] return help bRunningFromCDS = False try: p = projects.primary bRunningFromCDS = True print("running from cds") except: print("not running from cds") pass # do the xml export workingdir = os.path.dirname(sys.argv[0]) print(workingdir) sys.path.append(workingdir) import cds_script if bRunningFromCDS: from plcopenxml_export import export export(scriptargs) else: # running from cforge scriptname = os.path.join(workingdir, "plcopenxml_export.py") scriptargs = sys.argv[1] cds_script.RunCodesysWithScript(scriptname, scriptargs) # do the commit print("commit") tsvn_workdir="C:\\Program Files\\TortoiseSVN\\bin\\" bCDSSvn = False try: dir(svn) bCDSSvn = True except: print("CODESYS SVN not installed!") exit() elif os.path.exists(tsvn_workdir): print("using Tortoise svn") filename = scriptargs e = cds_script.RunProcess(tsvn_workdir,"SubWCRev.exe", filename) if e == 10: # is not a working copy: cds_script.RunProcess(tsvn_workdir,"TortoiseProc.exe", '/command:import "/path:' + filename + '"') else: cds_script.RunProcess(tsvn_workdir,"TortoiseProc.exe", '/command:commit "/path:' + filename + '"') else: print("SVN not installed at all") |