python3 port, yet untested
This commit is contained in:
@ -4,7 +4,8 @@
|
||||
# soft linked to by many of the lib/Install.py files
|
||||
# used to automate the steps described in the corresponding lib/README
|
||||
|
||||
import sys,commands,os
|
||||
from __future__ import print_function
|
||||
import sys,os,subprocess
|
||||
|
||||
# help message
|
||||
|
||||
@ -12,7 +13,7 @@ help = """
|
||||
Syntax from src dir: make lib-libname args="-m machine -e suffix"
|
||||
Syntax from lib dir: python Install.py -m machine -e suffix
|
||||
|
||||
libname = name of lib dir (e.g. atc, colvars, h5md, meam, poems, etc)
|
||||
libname = name of lib dir (e.g. atc, h5md, meam, poems, etc)
|
||||
specify -m and optionally -e, order does not matter
|
||||
|
||||
-m = peform a clean followed by "make -f Makefile.machine"
|
||||
@ -20,17 +21,17 @@ specify -m and optionally -e, order does not matter
|
||||
-e = set EXTRAMAKE variable in Makefile.machine to Makefile.lammps.suffix
|
||||
does not alter existing Makefile.machine
|
||||
|
||||
Examplesx:
|
||||
Examples:
|
||||
|
||||
make lib-colvars args="-m g++" # build COLVARS lib with GNU g++ compiler
|
||||
make lib-poems args="-m g++" # build COLVARS lib with GNU g++ compiler
|
||||
make lib-meam args="-m ifort" # build MEAM lib with Intel ifort compiler
|
||||
"""
|
||||
|
||||
# print error message or help
|
||||
|
||||
def error(str=None):
|
||||
if not str: print help
|
||||
else: print "ERROR",str
|
||||
if not str: print(help)
|
||||
else: print("ERROR",str)
|
||||
sys.exit()
|
||||
|
||||
# parse args
|
||||
@ -80,12 +81,12 @@ fp.close()
|
||||
|
||||
# make the library via Makefile.auto
|
||||
|
||||
print "Building lib%s.a ..." % lib
|
||||
print("Building lib%s.a ..." % lib)
|
||||
cmd = "make -f Makefile.auto clean; make -f Makefile.auto"
|
||||
txt = commands.getoutput(cmd)
|
||||
print txt
|
||||
txt = subprocess.check_output(cmd,shell=True,stderr=subprocess.STDOUT)
|
||||
print(txt)
|
||||
|
||||
if os.path.exists("lib%s.a" % lib): print "Build was successful"
|
||||
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))
|
||||
if not os.path.exists("Makefile.lammps"):
|
||||
print "lib/%s/Makefile.lammps was NOT created" % lib
|
||||
print("lib/%s/Makefile.lammps was NOT created" % lib)
|
||||
|
||||
Reference in New Issue
Block a user