remove attempts to use urllib and use curl for all downloading. restore printing help with no flags.
This commit is contained in:
@ -23,8 +23,9 @@ specify -m and optionally -e, order does not matter
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
make lib-poems args="-m g++" # build COLVARS lib with GNU g++ compiler
|
make lib-poems args="-m serial" # build POEMS lib with same settings as in the serial Makefile in src
|
||||||
make lib-meam args="-m ifort" # build MEAM lib with Intel ifort compiler
|
make lib-colvars args="-m mpi" # build USER-COLVARS lib with same settings as in the mpi Makefile in src
|
||||||
|
make lib-meam args="-m ifort" # build MEAM lib with custom Makefile.ifort (using Intel Fortran)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# print error message or help
|
# print error message or help
|
||||||
|
|||||||
@ -1,44 +1,41 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# install.py tool to setup the kim-api library
|
# install.py tool to download, compile, and setup the kim-api library
|
||||||
# used to automate the steps described in the README file in this dir
|
# used to automate the steps described in the README file in this dir
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys,os,re,subprocess
|
import sys,os,re,subprocess
|
||||||
|
|
||||||
# transparently use either urllib or an external tool
|
|
||||||
try:
|
|
||||||
import ssl
|
|
||||||
try: from urllib.request import urlretrieve as geturl
|
|
||||||
except: from urllib import urlretrieve as geturl
|
|
||||||
except:
|
|
||||||
def geturl(url,fname):
|
|
||||||
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
|
||||||
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
|
||||||
return txt
|
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax from src dir: make lib-kim args="-v version -a kim-name"
|
Syntax from src dir: make lib-kim args="-b -v version -a kim-name"
|
||||||
Syntax from lib dir: python Install.py -v version -a kim-name
|
or: make lib-kim args="-b -a everything"
|
||||||
|
or: make lib-kim args="-n -a kim-name"
|
||||||
|
or: make lib-kim args="-p /usr/local/open-kim -a kim-name"
|
||||||
|
Syntax from lib dir: python Install.py -b -v version -a kim-name
|
||||||
|
or: python Install.py -b -a everything
|
||||||
|
or: python Install.py -n -a kim-name
|
||||||
|
or: python Install.py -p /usr/local/open-kim -a kim-name
|
||||||
|
|
||||||
specify one or more options, order does not matter
|
specify one or more options, order does not matter
|
||||||
|
|
||||||
-v = version of KIM API library to use
|
-v = version of KIM API library to use
|
||||||
default = kim-api-v1.8.2 (current as of June 2017)
|
default = kim-api-v1.8.2 (current as of June 2017)
|
||||||
-b = download and build base KIM API library with example Models (default)
|
-b = download and build base KIM API library with example Models
|
||||||
this will delete any previous installation in the current folder
|
this will delete any previous installation in the current folder
|
||||||
-n = do NOT download and build base KIM API library. Use an existing installation
|
-n = do NOT download and build base KIM API library.
|
||||||
|
Use an existing installation
|
||||||
-p = specify location of KIM API installation (implies -n)
|
-p = specify location of KIM API installation (implies -n)
|
||||||
-a = add single KIM model or model driver with kim-name
|
-a = add single KIM model or model driver with kim-name
|
||||||
to existing KIM API lib (see example below).
|
to existing KIM API lib (see example below).
|
||||||
If kim-name = everything, then rebuild KIM API library with
|
If kim-name = everything, then rebuild KIM API library with
|
||||||
all available OpenKIM Models (this implies -b).
|
*all* available OpenKIM Models (make take a long time).
|
||||||
-vv = be more verbose about what is happening while the script runs
|
-vv = be more verbose about what is happening while the script runs
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
make lib-kim # install KIM API lib with only example models
|
make lib-kim args="-b" # install KIM API lib with only example models
|
||||||
make lib-kim args="-a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # Ditto plus one model
|
make lib-kim args="-a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # Ditto plus one model
|
||||||
make lib-kim args="-a everything" # install KIM API lib with all models
|
make lib-kim args="-b -a everything" # install KIM API lib with all models
|
||||||
make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # only add one model or model driver
|
make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # only add one model or model driver
|
||||||
|
|
||||||
See the list of KIM model drivers here:
|
See the list of KIM model drivers here:
|
||||||
@ -52,8 +49,9 @@ https://openkim.org/kim-api
|
|||||||
in the "What is in the KIM API source package?" section
|
in the "What is in the KIM API source package?" section
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def error():
|
def error(str=None):
|
||||||
print(help)
|
if not str: print(help)
|
||||||
|
else: print("ERROR",str)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# expand to full path name
|
# expand to full path name
|
||||||
@ -62,15 +60,21 @@ def error():
|
|||||||
def fullpath(path):
|
def fullpath(path):
|
||||||
return os.path.abspath(os.path.expanduser(path))
|
return os.path.abspath(os.path.expanduser(path))
|
||||||
|
|
||||||
|
def geturl(url,fname):
|
||||||
|
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
||||||
|
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
return txt
|
||||||
|
|
||||||
# parse args
|
# parse args
|
||||||
|
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
nargs = len(args)
|
nargs = len(args)
|
||||||
|
if nargs == 0: error()
|
||||||
|
|
||||||
thisdir = os.environ['PWD']
|
thisdir = os.environ['PWD']
|
||||||
version = "kim-api-v1.8.2"
|
version = "kim-api-v1.8.2"
|
||||||
|
|
||||||
buildflag = True
|
buildflag = False
|
||||||
everythingflag = False
|
everythingflag = False
|
||||||
addflag = False
|
addflag = False
|
||||||
verboseflag = False
|
verboseflag = False
|
||||||
|
|||||||
@ -6,32 +6,26 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys,os,re,subprocess
|
import sys,os,re,subprocess
|
||||||
|
|
||||||
try:
|
|
||||||
import ssl
|
|
||||||
try: from urllib.request import urlretrieve as geturl
|
|
||||||
except: from urllib import urlretrieve as geturl
|
|
||||||
except:
|
|
||||||
def geturl(url,fname):
|
|
||||||
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
|
||||||
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
|
||||||
return txt
|
|
||||||
|
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax from src dir: make lib-mscg args="-p [path] -m [suffix]"
|
Syntax from src dir: make lib-mscg args="-p [path] -m [suffix]"
|
||||||
|
or: make lib-mscg args="-b -m [suffix]"
|
||||||
Syntax from lib dir: python Install.py -p [path] -m [suffix]
|
Syntax from lib dir: python Install.py -p [path] -m [suffix]
|
||||||
|
Syntax from lib dir: python Install.py -b -m [suffix]
|
||||||
|
|
||||||
specify one or more options, order does not matter
|
specify one or more options, order does not matter
|
||||||
|
|
||||||
-b = download and build MS-CG library (default)
|
-b = download and build MS-CG library
|
||||||
-p = specify folder of existing MS-CG installation
|
-p = specify folder of existing MS-CG installation
|
||||||
-m = machine suffix specifies which src/Make/Makefile.suffix to use
|
-m = machine suffix specifies which src/Make/Makefile.suffix to use
|
||||||
default suffix = g++_simple
|
default suffix = g++_simple
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
make lib-mscg args="-b " # download/build in lib/mscg/MSCG-release-master
|
make lib-mscg args="-b -m serial " # download/build in lib/mscg/MSCG-release-master with settings compatible with "make serial"
|
||||||
|
make lib-mscg args="-b -m mpi " # download/build in lib/mscg/MSCG-release-master with settings compatible with "make mpi"
|
||||||
|
make lib-mscg args="-p /usr/local/mscg-release " # use existing MS-CG installation in /usr/local/mscg-release
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
@ -53,15 +47,21 @@ def error(str=None):
|
|||||||
def fullpath(path):
|
def fullpath(path):
|
||||||
return os.path.abspath(os.path.expanduser(path))
|
return os.path.abspath(os.path.expanduser(path))
|
||||||
|
|
||||||
|
def geturl(url,fname):
|
||||||
|
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
||||||
|
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
return txt
|
||||||
|
|
||||||
# parse args
|
# parse args
|
||||||
|
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
nargs = len(args)
|
nargs = len(args)
|
||||||
|
if nargs == 0: error()
|
||||||
|
|
||||||
homepath = "."
|
homepath = "."
|
||||||
homedir = tardir
|
homedir = tardir
|
||||||
|
|
||||||
buildflag = True
|
buildflag = False
|
||||||
pathflag = False
|
pathflag = False
|
||||||
linkflag = True
|
linkflag = True
|
||||||
msuffix = "g++_simple"
|
msuffix = "g++_simple"
|
||||||
@ -72,7 +72,6 @@ while iarg < nargs:
|
|||||||
if iarg+2 > nargs: error()
|
if iarg+2 > nargs: error()
|
||||||
mscgpath = fullpath(args[iarg+1])
|
mscgpath = fullpath(args[iarg+1])
|
||||||
pathflag = True
|
pathflag = True
|
||||||
buildflag = False
|
|
||||||
iarg += 2
|
iarg += 2
|
||||||
elif args[iarg] == "-m":
|
elif args[iarg] == "-m":
|
||||||
if iarg+2 > nargs: error()
|
if iarg+2 > nargs: error()
|
||||||
@ -93,6 +92,9 @@ if (pathflag):
|
|||||||
if (buildflag and pathflag):
|
if (buildflag and pathflag):
|
||||||
error("Cannot use -b and -p flag at the same time")
|
error("Cannot use -b and -p flag at the same time")
|
||||||
|
|
||||||
|
if (not buildflag and not pathflag):
|
||||||
|
error("Have to use either -b or -p flag")
|
||||||
|
|
||||||
# download and unpack MS-CG tarfile
|
# download and unpack MS-CG tarfile
|
||||||
|
|
||||||
if buildflag:
|
if buildflag:
|
||||||
|
|||||||
@ -5,22 +5,20 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys,os,re,glob,subprocess
|
import sys,os,re,glob,subprocess
|
||||||
try: from urllib.request import urlretrieve as geturl
|
|
||||||
except: from urllib import urlretrieve as geturl
|
|
||||||
|
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax from src dir: make lib-smd
|
Syntax from src dir: make lib-smd args="-b"
|
||||||
or: make lib-smd args="-p /usr/include/eigen3"
|
or: make lib-smd args="-p /usr/include/eigen3"
|
||||||
|
|
||||||
Syntax from lib dir: python Install.py
|
Syntax from lib dir: python Install.py -b
|
||||||
or: python Install.py -p /usr/include/eigen3"
|
or: python Install.py -p /usr/include/eigen3"
|
||||||
or: python Install.py -v 3.3.4 -b
|
or: python Install.py -v 3.3.4 -b
|
||||||
|
|
||||||
specify one or more options, order does not matter
|
specify one or more options, order does not matter
|
||||||
|
|
||||||
-b = download and unpack/configure the Eigen library (default)
|
-b = download and unpack/configure the Eigen library
|
||||||
-p = specify folder holding an existing installation of Eigen
|
-p = specify folder holding an existing installation of Eigen
|
||||||
-v = set version of Eigen library to download and set up (default = 3.3.4)
|
-v = set version of Eigen library to download and set up (default = 3.3.4)
|
||||||
|
|
||||||
@ -28,6 +26,7 @@ specify one or more options, order does not matter
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
make lib-smd args="-b" # download/build in default lib/smd/eigen-eigen-*
|
make lib-smd args="-b" # download/build in default lib/smd/eigen-eigen-*
|
||||||
|
make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
@ -48,16 +47,21 @@ def error(str=None):
|
|||||||
def fullpath(path):
|
def fullpath(path):
|
||||||
return os.path.abspath(os.path.expanduser(path))
|
return os.path.abspath(os.path.expanduser(path))
|
||||||
|
|
||||||
|
def geturl(url,fname):
|
||||||
|
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
||||||
|
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
return txt
|
||||||
|
|
||||||
# parse args
|
# parse args
|
||||||
|
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
nargs = len(args)
|
nargs = len(args)
|
||||||
|
if nargs == 0: error()
|
||||||
|
|
||||||
homepath = "."
|
homepath = "."
|
||||||
homedir = "eigen3"
|
homedir = "eigen3"
|
||||||
|
|
||||||
grabflag = True
|
buildflag = False
|
||||||
buildflag = True
|
|
||||||
pathflag = False
|
pathflag = False
|
||||||
linkflag = True
|
linkflag = True
|
||||||
|
|
||||||
@ -71,7 +75,6 @@ while iarg < nargs:
|
|||||||
if iarg+2 > nargs: error()
|
if iarg+2 > nargs: error()
|
||||||
eigenpath = fullpath(args[iarg+1])
|
eigenpath = fullpath(args[iarg+1])
|
||||||
pathflag = True
|
pathflag = True
|
||||||
buildflag = False
|
|
||||||
iarg += 2
|
iarg += 2
|
||||||
elif args[iarg] == "-b":
|
elif args[iarg] == "-b":
|
||||||
buildflag = True
|
buildflag = True
|
||||||
@ -86,6 +89,9 @@ if (pathflag):
|
|||||||
if (buildflag and pathflag):
|
if (buildflag and pathflag):
|
||||||
error("Cannot use -b and -p flag at the same time")
|
error("Cannot use -b and -p flag at the same time")
|
||||||
|
|
||||||
|
if (not buildflag and not pathflag):
|
||||||
|
error("Have to use either -b or -p flag")
|
||||||
|
|
||||||
# download and unpack Eigen tarball
|
# download and unpack Eigen tarball
|
||||||
# use glob to find name of dir it unpacks to
|
# use glob to find name of dir it unpacks to
|
||||||
|
|
||||||
|
|||||||
@ -6,35 +6,26 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys,os,re,subprocess
|
import sys,os,re,subprocess
|
||||||
|
|
||||||
try:
|
|
||||||
import ssl
|
|
||||||
try: from urllib.request import urlretrieve as geturl
|
|
||||||
except: from urllib import urlretrieve as geturl
|
|
||||||
except:
|
|
||||||
def geturl(url,fname):
|
|
||||||
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
|
||||||
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
|
||||||
return txt
|
|
||||||
|
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax from src dir: make lib-voronoi
|
Syntax from src dir: make lib-voronoi args="-b"
|
||||||
or: make lib-voronoi args="-p /usr/local/voro++-0.4.6"
|
or: make lib-voronoi args="-p /usr/local/voro++-0.4.6"
|
||||||
or: make lib-voronoi args="-v voro++-0.4.6 -b"
|
or: make lib-voronoi args="-b -v voro++-0.4.6"
|
||||||
Syntax from lib dir: python Install.py -v voro++-0.4.6 -b
|
Syntax from lib dir: python Install.py -b -v voro++-0.4.6
|
||||||
or: python Install.py
|
or: python Install.py -b
|
||||||
or: python Install.py -p /usr/local/voro++-0.4.6
|
or: python Install.py -p /usr/local/voro++-0.4.6
|
||||||
|
|
||||||
specify one or more options, order does not matter
|
specify one or more options, order does not matter
|
||||||
|
|
||||||
-b = download and build the Voro++ library (default)
|
-b = download and build the Voro++ library
|
||||||
-p = specify folder of existing Voro++ installation
|
-p = specify folder of existing Voro++ installation
|
||||||
-v = set version of Voro++ to download and build (default voro++-0.4.6)
|
-v = set version of Voro++ to download and build (default voro++-0.4.6)
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
make lib-voronoi args="-b" # download/build in lib/voronoi/voro++-0.4.6
|
make lib-voronoi args="-b" # download/build in lib/voronoi/voro++-0.4.6
|
||||||
|
make lib-voronoi args="-p $HOME/voro++-0.4.6" # use existing Voro++ installation in $HOME/voro++-0.4.6
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
@ -55,15 +46,21 @@ def error(str=None):
|
|||||||
def fullpath(path):
|
def fullpath(path):
|
||||||
return os.path.abspath(os.path.expanduser(path))
|
return os.path.abspath(os.path.expanduser(path))
|
||||||
|
|
||||||
|
def geturl(url,fname):
|
||||||
|
cmd = 'curl -L -o "%s" %s' % (fname,url)
|
||||||
|
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
return txt
|
||||||
|
|
||||||
# parse args
|
# parse args
|
||||||
|
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
nargs = len(args)
|
nargs = len(args)
|
||||||
|
if nargs == 0: error()
|
||||||
|
|
||||||
homepath = "."
|
homepath = "."
|
||||||
homedir = version
|
homedir = version
|
||||||
|
|
||||||
buildflag = True
|
buildflag = False
|
||||||
pathflag = False
|
pathflag = False
|
||||||
linkflag = True
|
linkflag = True
|
||||||
|
|
||||||
@ -77,7 +74,6 @@ while iarg < nargs:
|
|||||||
if iarg+2 > nargs: error()
|
if iarg+2 > nargs: error()
|
||||||
voropath = fullpath(args[iarg+1])
|
voropath = fullpath(args[iarg+1])
|
||||||
pathflag = True
|
pathflag = True
|
||||||
buildflag = False
|
|
||||||
iarg += 2
|
iarg += 2
|
||||||
elif args[iarg] == "-b":
|
elif args[iarg] == "-b":
|
||||||
buildflag = True
|
buildflag = True
|
||||||
@ -94,6 +90,9 @@ if (pathflag):
|
|||||||
if (buildflag and pathflag):
|
if (buildflag and pathflag):
|
||||||
error("Cannot use -b and -p flag at the same time")
|
error("Cannot use -b and -p flag at the same time")
|
||||||
|
|
||||||
|
if (not buildflag and not pathflag):
|
||||||
|
error("Have to use either -b or -p flag")
|
||||||
|
|
||||||
# download and unpack Voro++ tarball
|
# download and unpack Voro++ tarball
|
||||||
|
|
||||||
if buildflag:
|
if buildflag:
|
||||||
|
|||||||
Reference in New Issue
Block a user