From 4eed2d0937a1188dffbee864a96b89b44ff96564 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Tue, 18 Oct 2016 18:35:54 +0200 Subject: [PATCH] remove subprocess pipes --- scripts/salome_compile.py | 12 ++++++------ scripts/salome_download.py | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/salome_compile.py b/scripts/salome_compile.py index 587955e..418e53b 100644 --- a/scripts/salome_compile.py +++ b/scripts/salome_compile.py @@ -18,7 +18,7 @@ def __getCurrentVersion(srcDir,pattern, config): return s elif isinstance(srcLoc,tuple): dirGitLoc=os.path.splitext(os.path.basename(srcLoc[0]))[0] - p=subprocess.Popen(["git","rev-parse","--verify","HEAD"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["git","rev-parse","--verify","HEAD"],cwd=dirGitLoc) p_out,p_err=p.communicate() if p.returncode != 0: msg = "Error in __getCurrentVersion\n" + p_err @@ -81,7 +81,7 @@ def __compilePart2(topSrcDir,pattern,config,envAcc,buildDir,splitInstall): print("make in %s"%(buildDir)) paraCompFlag = config["paraCompFlag"] if not splitInstall: - p=subprocess.Popen(["make",paraCompFlag,"install"],cwd=buildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["make",paraCompFlag,"install"],cwd=buildDir,env=computeEnv(envAcc)) a,b=p.communicate() f=file(os.path.join(buildDir,compOut),"w") ; f.write(a) ; f.flush() f=file(os.path.join(buildDir,compErr),"w") ; f.write(b) ; f.flush() @@ -89,14 +89,14 @@ def __compilePart2(topSrcDir,pattern,config,envAcc,buildDir,splitInstall): msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,compOut), os.path.join(buildDir,compErr)) raise Exception(msg) else: - p=subprocess.Popen(["make",paraCompFlag],cwd=buildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["make",paraCompFlag],cwd=buildDir,env=computeEnv(envAcc)) a0,b0=p.communicate() f=file(os.path.join(buildDir,compOut),"w") ; f.write(a0) ; f.flush() f=file(os.path.join(buildDir,compErr),"w") ; f.write(b0) ; f.flush() if p.returncode != 0: msg = "Error in build step. See details in %s and %s\n"%(os.path.join(buildDir,compOut), os.path.join(buildDir,compErr)) raise Exception(msg) - p=subprocess.Popen(["make",paraCompFlag,"install"],cwd=buildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["make",paraCompFlag,"install"],cwd=buildDir,env=computeEnv(envAcc)) a1,b1=p.communicate() f=file(os.path.join(buildDir,compOut),"w") ; f.write(a0+a1) ; f.flush() f=file(os.path.join(buildDir,compErr),"w") ; f.write(b0+b1) ; f.flush() @@ -117,7 +117,7 @@ def __compileOldCommon(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topIns return myInstallDir myCmd=[os.path.join(srcDir,"configure"),"--prefix=%s"%(myInstallDir)]+addCfgParam print "Command: ", " ".join(myCmd) - p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc)) __compilePart1(p,myBuildDir) __compilePart2(topSrcDir,pattern,config,envAcc,myBuildDir,splitInstall) return myInstallDir @@ -134,7 +134,7 @@ def compileNew(topSrcDir,pattern,config,envAcc,srcDir,topBuildDir,topInstallDir, return myInstallDir myCmd=["cmake","-DCMAKE_INSTALL_PREFIX=%s"%(myInstallDir)]+addCfgParam+[srcDir] print(" ".join(myCmd)) - p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc),stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(myCmd,cwd=myBuildDir,env=computeEnv(envAcc)) __compilePart1(p,myBuildDir) __compilePart2(topSrcDir,pattern,config,envAcc,myBuildDir,False) return myInstallDir diff --git a/scripts/salome_download.py b/scripts/salome_download.py index e59244a..a44b4d8 100644 --- a/scripts/salome_download.py +++ b/scripts/salome_download.py @@ -80,7 +80,7 @@ def __extractSrcFromGit(gitLoc,srcDir,pattern,use_pleiade_mirrors=False): if not os.path.exists(dirGitLoc): print("Cloning %s..."%dirGitLoc) def __connect(): - p=subprocess.Popen("GIT_SSL_NO_VERIFY=true git clone %s"%(gitLoc[0]), shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen("GIT_SSL_NO_VERIFY=true git clone %s"%(gitLoc[0]), shell=True) p_out,p_err=p.communicate() return p.returncode, p_out, p_err @@ -103,7 +103,7 @@ def __extractSrcFromGit(gitLoc,srcDir,pattern,use_pleiade_mirrors=False): local_command = "git config " local_command += "-f .gitmodules " local_command += "submodule.%s.url %s" % (key, val) - p=subprocess.Popen(local_command,cwd=dirGitLoc,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(local_command,cwd=dirGitLoc,shell=True) p.communicate() else: @@ -114,21 +114,21 @@ def __extractSrcFromGit(gitLoc,srcDir,pattern,use_pleiade_mirrors=False): local_command = "git config " local_command += "-f .gitmodules " local_command += "submodule.%s.url %s" % (key, val) - p=subprocess.Popen(local_command,cwd=dirGitLoc,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(local_command,cwd=dirGitLoc,shell=True) p.communicate() # Fetch print("Fetching %s..."%dirGitLoc) assert(os.path.exists(os.path.join(dirGitLoc,".git"))) - p=subprocess.Popen(["git","fetch","--prune"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["git","fetch","--prune"],cwd=dirGitLoc) p.communicate() - p=subprocess.Popen(["git","fetch","--tags"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["git","fetch","--tags"],cwd=dirGitLoc) p.communicate() pass pass # Checkout - p=subprocess.Popen(["git","checkout",gitLoc[1]],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["git","checkout",gitLoc[1]],cwd=dirGitLoc) p_out,p_err=p.communicate() if p.returncode != 0: msg = "Error in checkout\n" + p_err @@ -136,12 +136,12 @@ def __extractSrcFromGit(gitLoc,srcDir,pattern,use_pleiade_mirrors=False): # Init and Update submodules if dirGitLoc in ["ParaView", "prerequisites-salome.paraview"]: - p=subprocess.Popen(["git","submodule","update","--init","--recursive"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["git","submodule","update","--init","--recursive"],cwd=dirGitLoc) p.communicate() if p.returncode != 0: msg = "Error in submodule update\n" + p_err raise Exception(msg) - p=subprocess.Popen(["git","checkout","--",".gitmodules"],cwd=dirGitLoc,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p=subprocess.Popen(["git","checkout","--",".gitmodules"],cwd=dirGitLoc) p.communicate() if p.returncode != 0: msg = "Error in submodule update\n" + p_err -- 2.39.2