Commit eda79bd1 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

use shutil.rmtree() instead of calling 'rm -rf' for increased portability

parent a4d21370
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -143,8 +143,8 @@ fp.close()

if makeflag:
  print("Building libgpu.a ...")
  cmd = "rm -f libgpu.a"
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  if os.path.exists("libgpu.a"):
    os.remove("libgpu.a")
  cmd = "make -f Makefile.auto clean; make -f Makefile.auto"
  txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  print(txt.decode('UTF-8'))
+2 −3
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
# used to automate the steps described in the README file in this dir

from __future__ import print_function
import sys,os,re,subprocess
import sys,os,re,subprocess,shutil

# help message

@@ -177,8 +177,7 @@ if buildflag:

  if os.path.isdir(kimdir):
    print("kim-api is already installed at %s.\nRemoving it for re-install" % kimdir)
    cmd = 'rm -rf "%s"' % kimdir
    subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    shutil.rmtree(kimdir)

  # configure LAMMPS to use kim-api to be installed

+2 −3
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
# used to automate the steps described in the README file in this dir

from __future__ import print_function
import sys,os,re,subprocess,hashlib
import sys,os,re,subprocess,hashlib,shutil

# help message

@@ -167,8 +167,7 @@ if buildflag:

  print("Unpacking LATTE ...")
  if os.path.exists(lattedir):
    cmd = 'rm -rf "%s"' % lattedir
    subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    shutil.rmtree(lattedir)
  cmd = 'cd "%s"; tar zxvf LATTE.tar.gz' % lattepath
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  os.remove("%s/LATTE.tar.gz" % lattepath)
+3 −5
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
# used to automate the steps described in the README file in this dir

from __future__ import print_function
import sys,os,re,subprocess
import sys,os,re,subprocess,shutil

# help message

@@ -139,15 +139,13 @@ if buildflag:

  print("Unpacking MS-CG tarfile ...")
  if os.path.exists("%s/%s" % (homepath,tardir)):
    cmd = 'rm -rf "%s/%s"' % (homepath,tardir)
    subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    shutil.rmtree("%s/%s" % (homepath,tardir))
  cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarfile)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  os.remove("%s/%s" % (homepath,tarfile))
  if os.path.basename(homedir) != tardir:
    if os.path.exists(homedir):
      cmd = 'rm -rf "%s"' % homedir
      subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
      shutil.rmtree(homedir)
    os.rename("%s/%s" % (homepath,tardir),homedir)

# build MS-CG
+3 −5
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
# used to automate the steps described in the README file in this dir

from __future__ import print_function
import sys,os,re,subprocess,hashlib
import sys,os,re,subprocess,hashlib,shutil

# help message

@@ -169,11 +169,9 @@ if buildflag:

  print("Unpacking plumed2 source tarball ...")
  if os.path.exists("%s/plumed-%s" % (homepath,version)):
    cmd = 'rm -rf "%s/plumed-%s"' % (homepath,version)
    subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    shutil.rmtree("%s/plumed-%s" % (homepath,version))
  if os.path.exists(homedir):
    cmd = 'rm -rf "%s"' % (homedir)
    subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    shutil.rmtree(homedir)
  cmd = 'cd "%s"; tar -xzvf %s' % (homepath,filename)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  os.remove("%s/%s" % (homepath,filename))
Loading