git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8656 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -1,25 +1,35 @@
|
||||
#!/usr/local/bin/python
|
||||
|
||||
# copy lammps.py and LAMMPS shared library src/liblmp.so to
|
||||
# Python site-packages dir
|
||||
# copy LAMMPS shared library src/liblmp.so and lammps.py to system dirs
|
||||
# Syntax: python install.py [libdir] [pydir]
|
||||
# libdir = target dir for src/liblammps.so, default = /usr/local/lib
|
||||
# pydir = target dir for lammps.py, default = Python site-packages dir
|
||||
|
||||
import sys,commands
|
||||
|
||||
# find this Python's site-packages dir in sys.path list
|
||||
if len(sys.argv) > 3:
|
||||
print "Syntax: python install.py [libdir] [pydir]"
|
||||
sys.exit()
|
||||
|
||||
paths = sys.path
|
||||
for i,path in enumerate(paths):
|
||||
index = path.rfind("site-packages")
|
||||
if index < 0: continue
|
||||
if index == len(path) - len("site-packages"): break
|
||||
sitedir = paths[i]
|
||||
if len(sys.argv) >= 2: libdir = sys.argv[1]
|
||||
else: libdir = "/usr/local/lib"
|
||||
|
||||
str = "cp ../python/lammps.py %s" % sitedir
|
||||
if len(sys.argv) == 3: pydir = sys.argv[2]
|
||||
else:
|
||||
paths = sys.path
|
||||
for i,path in enumerate(paths):
|
||||
index = path.rfind("site-packages")
|
||||
if index < 0: continue
|
||||
if index == len(path) - len("site-packages"): break
|
||||
pydir = paths[i]
|
||||
|
||||
str = "cp ../src/liblammps.so %s" % libdir
|
||||
print str
|
||||
outstr = commands.getoutput(str)
|
||||
if len(outstr.strip()): print outstr
|
||||
|
||||
str = "cp ../src/liblmp.so %s" % sitedir
|
||||
str = "cp ../python/lammps.py %s" % pydir
|
||||
print str
|
||||
outstr = commands.getoutput(str)
|
||||
if len(outstr.strip()): print outstr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user