use sys.exit() instead of the removed error() function

This commit is contained in:
Axel Kohlmeyer 2019-01-14 14:13:40 -05:00
parent 59559f74e6
commit c3a15e221d
5 changed files with 16 additions and 13 deletions

View File

@ -53,7 +53,7 @@ lib = os.path.basename(cwd)
# reset EXTRAMAKE if requested
if not os.path.exists("Makefile.%s" % machine):
error("lib/%s/Makefile.%s does not exist" % (lib,machine))
sys.exit("lib/%s/Makefile.%s does not exist" % (lib,machine))
lines = open("Makefile.%s" % machine,'r').readlines()
fp = open("Makefile.auto",'w')
@ -82,7 +82,7 @@ except subprocess.CalledProcessError as e:
sys.exit(1)
if os.path.exists("lib%s.a" % lib): print("Build was successful")
else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib))
else: sys.exit("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib))
if has_extramake and not os.path.exists("Makefile.lammps"):
print("WARNING: lib/%s/Makefile.lammps was NOT created" % lib)

View File

@ -89,7 +89,7 @@ if args.output:
# reset EXTRAMAKE, CUDA_HOME, CUDA_ARCH, CUDA_PRECISION if requested
if not os.path.exists("Makefile.%s" % isuffix):
error("lib/gpu/Makefile.%s does not exist" % isuffix)
sys.exit("lib/gpu/Makefile.%s does not exist" % isuffix)
lines = open("Makefile.%s" % isuffix,'r').readlines()
fp = open("Makefile.auto",'w')
@ -129,9 +129,9 @@ if makeflag:
sys.exit(1)
if not os.path.exists("libgpu.a"):
error("Build of lib/gpu/libgpu.a was NOT successful")
sys.exit("Build of lib/gpu/libgpu.a was NOT successful")
if not os.path.exists("Makefile.lammps"):
error("lib/gpu/Makefile.lammps was NOT created")
sys.exit("lib/gpu/Makefile.lammps was NOT created")
# copy new Makefile.auto to Makefile.osuffix

View File

@ -73,8 +73,9 @@ homepath = fullpath('.')
homedir = "%s/%s" % (homepath,tardir)
if (pathflag):
if not os.path.isdir(mscgpath): error("MS-CG path does not exist")
homedir = mscgpath
if not os.path.isdir(mscgpath):
sys.exit("MS-CG path %s does not exist" % mscgpath)
homedir = fullpath(mscgpath)
# download and unpack MS-CG tarfile
@ -104,7 +105,7 @@ if buildflag:
cmd = 'cd "%s/src"; cp ../../Makefile.%s .; make -f Makefile.%s' % \
(homedir,msuffix,msuffix)
else:
error("Cannot find Makefile.%s" % msuffix)
sys.exit("Cannot find Makefile.%s" % msuffix)
try:
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
print(txt.decode('UTF-8'))

View File

@ -68,8 +68,9 @@ homepath = fullpath('.')
homedir = "%s/plumed2" % (homepath)
if (pathflag):
if not os.path.isdir(plumedpath): error("Plumed2 path does not exist")
homedir = plumedpath
if not os.path.isdir(plumedpath):
sys.exit("Plumed2 path %s does not exist" % plumedpath)
homedir = fullpath(plumedpath)
# download and unpack plumed2 tarball
@ -82,7 +83,7 @@ if buildflag:
# verify downloaded archive integrity via md5 checksum, if known.
if version in checksums:
if not checkmd5sum(checksums[version],filename):
error("Checksum for plumed2 library does not match")
sys.exit("Checksum for plumed2 library does not match")
print("Unpacking plumed2 source tarball ...")
if os.path.exists("%s/plumed-%s" % (homepath,version)):
@ -103,7 +104,7 @@ if buildflag:
except subprocess.CalledProcessError as e:
print("Make failed with:\n %s" % e.output.decode('UTF-8'))
sys.exit(1)
# create 2 links in lib/plumed to plumed2 installation dir
print("Creating links to plumed2 include and lib files")

View File

@ -59,7 +59,8 @@ homepath = fullpath(".")
homedir = "%s/%s" % (homepath,version)
if (pathflag):
if not os.path.isdir(voropath): error("Voro++ path does not exist")
if not os.path.isdir(voropath):
sys.exit("Voro++ path %s does not exist" % voropath)
homedir = voropath
# download and unpack Voro++ tarball