From c3a15e221d25ca79ebbb7069f2f4d6dfdd59227f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 14 Jan 2019 14:13:40 -0500 Subject: [PATCH] use sys.exit() instead of the removed error() function --- lib/Install.py | 4 ++-- lib/gpu/Install.py | 6 +++--- lib/mscg/Install.py | 7 ++++--- lib/plumed/Install.py | 9 +++++---- lib/voronoi/Install.py | 3 ++- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/Install.py b/lib/Install.py index e0ceacb220..605356d494 100644 --- a/lib/Install.py +++ b/lib/Install.py @@ -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) diff --git a/lib/gpu/Install.py b/lib/gpu/Install.py index 8f18bf3c7a..36024120ab 100644 --- a/lib/gpu/Install.py +++ b/lib/gpu/Install.py @@ -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 diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index ce74ef24d9..12a8aeb5c2 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -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')) diff --git a/lib/plumed/Install.py b/lib/plumed/Install.py index f68041d2d2..e1a46a2380 100644 --- a/lib/plumed/Install.py +++ b/lib/plumed/Install.py @@ -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") diff --git a/lib/voronoi/Install.py b/lib/voronoi/Install.py index b76ef42806..38f051d6b5 100644 --- a/lib/voronoi/Install.py +++ b/lib/voronoi/Install.py @@ -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