git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14592 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2016-02-15 15:30:15 +00:00
parent 729ba2cc21
commit a70623ee43
2 changed files with 51 additions and 14 deletions

View File

@ -37,12 +37,45 @@ print "installing lammps.py in Python site-packages dir"
os.chdir('../python') # in case invoked via make in src dir
# extract version string from header
fp = open('../src/version.h','r')
txt=fp.read().split('"')[1].split()
verstr=txt[0]+txt[1]+txt[2]
fp.close()
from distutils.core import setup
sys.argv = ["setup.py","install"] # as if had run "python setup.py install"
setup(name = "lammps",
version = "15May15",
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "http://lammps.sandia.gov",
description = "LAMMPS molecular dynamics library",
py_modules = ["lammps"])
from distutils.sysconfig import get_python_lib
import site
tryuser=False
try:
sys.argv = ["setup.py","install"] # as if had run "python setup.py install"
setup(name = "lammps",
version = verstr,
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "http://lammps.sandia.gov",
description = "LAMMPS molecular dynamics library",
py_modules = ["lammps"],
data_files = [(get_python_lib(), ["../src/liblammps.so"])])
except:
tryuser=True
print "Installation into global site-packages dir failed.\nTrying user site dir %s now." % site.USER_SITE
if tryuser:
try:
sys.argv = ["setup.py","install","--user"] # as if had run "python setup.py install --user"
setup(name = "lammps",
version = verstr,
author = "Steve Plimpton",
author_email = "sjplimp@sandia.gov",
url = "http://lammps.sandia.gov",
description = "LAMMPS molecular dynamics library",
py_modules = ["lammps"],
data_files = [(site.USER_SITE, ["../src/liblammps.so"])])
except:
print "Installation into user site package dir failed.\nGo to ../python and install manually."