forked from lijiext/lammps
python3 port, yet untested
This commit is contained in:
parent
0427f6205e
commit
acf6d54ec1
|
@ -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-meam args="-m ifort" # build MEAM lib with Intel ifort 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
|
||||
|
@ -47,12 +48,12 @@ while iarg < nargs:
|
|||
if args[iarg] == "-m":
|
||||
if iarg+2 > nargs: error()
|
||||
machine = args[iarg+1]
|
||||
iarg += 2
|
||||
iarg += 2
|
||||
elif args[iarg] == "-e":
|
||||
if iarg+2 > nargs: error()
|
||||
extraflag = 1
|
||||
suffix = args[iarg+1]
|
||||
iarg += 2
|
||||
iarg += 2
|
||||
else: error()
|
||||
|
||||
# set lib from working dir
|
||||
|
@ -62,7 +63,7 @@ lib = os.path.basename(cwd)
|
|||
|
||||
# create Makefile.auto as copy of Makefile.machine
|
||||
# reset EXTRAMAKE if requested
|
||||
|
||||
|
||||
if not os.path.exists("Makefile.%s" % machine):
|
||||
error("lib/%s/Makefile.%s does not exist" % (lib,machine))
|
||||
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue