--- a/trunk/cforge/cforge/Package/CFORGE/Scripts/cds_script.py +++ b/trunk/cforge/cforge/Package/CFORGE/Scripts/cds_script.py @@ -74,4 +74,44 @@ print("done: " + str(exitcode)) return exitcode +def RunPackageManager(args=None): + + # common paths + workingdir = os.path.dirname(sys.argv[0]) + cdsdir = os.path.abspath(os.path.join(workingdir, os.path.pardir, os.path.pardir)) + #print(cdsdir) + + # profile stuff + profiledir=os.path.join(cdsdir,"Profiles") + #print(profiledir) + lastprofile="" + for file in os.listdir(profiledir): + if file.endswith(".profile"): + lastprofile = file.replace(".profile","") + #print(lastprofile) + + # exe + packageman_exe = os.path.join(cdsdir, "Common", "PackageManager.exe") + workdir = os.path.join(cdsdir, "Common") + exitcode = -1 + + p = Process() + p.StartInfo.WorkingDirectory=workdir + p.StartInfo.FileName = packageman_exe + + processargs = "--profile='" + lastprofile + "' " + args + + print("running packman with args " + args) + p.StartInfo.Arguments = processargs + p.Start() + p.WaitForExit() + + exitcode = p.ExitCode + + print("done: " + str(exitcode)) + return exitcode + + + +