Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lammps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
multiscale
lammps
Commits
2e7bd336
Commit
2e7bd336
authored
12 years ago
by
sjplimp
Browse files
Options
Downloads
Patches
Plain Diff
git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@8672
f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent
8af673c6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/install.py
+51
-36
51 additions, 36 deletions
python/install.py
with
51 additions
and
36 deletions
python/install.py
+
51
−
36
View file @
2e7bd336
#!/usr/bin/
env
python
#!/usr/
local/
bin/python
instructions
=
"""
copy LAMMPS shared library src/liblammps.so and lammps.py to system dirs
# copy LAMMPS src/liblammps.so and lammps.py to system dirs
Syntax: python install.py [libdir] [pydir]
libdir = target dir for src/liblammps.so, default = /usr/local/lib, or the first
item in LD_LIBRARY_PATH if it doesn
'
t exist.
pydir = target dir for lammps.py, default = Python site-packages, via distutils.
"""
import
sys
,
shutil
,
os
instructions
=
"""
Syntax: python install.py [-h] [libdir] [pydir]
libdir = target dir for src/liblammps.so, default = /usr/local/lib
pydir = target dir for lammps.py, default = Python site-packages dir
"""
if
len
(
sys
.
argv
)
>
3
:
import
sys
,
os
,
commands
if
(
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
"
-h
"
)
or
len
(
sys
.
argv
)
>
3
:
print
instructions
print
instructions
sys
.
exit
()
sys
.
exit
()
# verify that our user-specified path is in LD_LIBRARY_PATH
if
len
(
sys
.
argv
)
>=
2
:
libdir
=
sys
.
argv
[
1
]
# since if not, the install won't work
else
:
libdir
=
"
/usr/local/lib
"
libdir
=
"
/usr/local/lib
"
if
len
(
sys
.
argv
)
==
3
:
pydir
=
sys
.
argv
[
2
]
libpaths
=
os
.
environ
[
'
LD_LIBRARY_PATH
'
].
split
(
'
:
'
)
else
:
pydir
=
""
if
not
libdir
in
libpaths
:
libdir
=
libpaths
[
0
]
pydir
=
False
# copy C lib to libdir if it exists
try
:
# warn if not in LD_LIBRARY_PATH or LD_LIBRARY_PATH is undefined
libdir
=
sys
.
argv
[
1
]
pydir
=
sys
.
argv
[
2
]
except
IndexError
:
pass
# copy the C library into place
if
not
os
.
path
.
isdir
(
libdir
):
print
"
ERROR: libdir %s does not exist
"
%
libdir
sys
.
exit
()
if
"
LD_LIBRARY_PATH
"
not
in
os
.
environ
:
print
"
WARNING: LD_LIBRARY_PATH undefined, cannot check libdir %s
"
%
libdir
else
:
libpaths
=
os
.
environ
[
'
LD_LIBRARY_PATH
'
].
split
(
'
:
'
)
if
libdir
not
in
libpaths
:
print
"
WARNING: libdir %s not in LD_LIBRARY_PATH
"
%
libdir
shutil
.
copy
(
'
../src/liblammps.so
'
,
libdir
)
str
=
"
cp ../src/liblammps.so %s
"
%
libdir
print
str
outstr
=
commands
.
getoutput
(
str
)
if
len
(
outstr
.
strip
()):
print
outstr
#
if user-specified,
copy lammps.py
in
to dir
ectory
# copy lammps.py to
py
dir
if it exists
#
else invoke setup from Distutils to add to site-packages
#
if pydir not specified, install in site-packages via distutils setup()
if
pydir
:
if
pydir
:
shutil
.
copy
(
'
../python/lammps.py
'
,
pydir
)
if
not
os
.
path
.
isdir
(
pydir
):
print
"
ERROR: pydir %s does not exist
"
%
pydir
sys
.
exit
()
sys
.
exit
()
str
=
"
cp ../python/lammps.py %s
"
%
pydir
print
str
outstr
=
commands
.
getoutput
(
str
)
if
len
(
outstr
.
strip
()):
print
outstr
sys
.
exit
()
print
"
installing lammps.py in Python site-packages dir
"
from
distutils.core
import
setup
os
.
chdir
(
'
../python
'
)
# in case invoked via make in src dir
os
.
chdir
(
'
../python
'
)
from
distutils.core
import
setup
sys
.
argv
=
[
"
setup.py
"
,
"
install
"
]
# as if had run "python setup.py install"
setup
(
name
=
"
lammps
"
,
setup
(
name
=
"
lammps
"
,
version
=
"
15Aug12
"
,
version
=
"
15Aug12
"
,
author
=
"
Steve Plimpton
"
,
author
=
"
Steve Plimpton
"
,
author_email
=
"
sjplimp@sandia.gov
"
,
author_email
=
"
sjplimp@sandia.gov
"
,
url
=
"
http://lammps.sandia.gov
"
,
url
=
"
http://lammps.sandia.gov
"
,
description
=
"""
LAMMPS molecular dynamics library
"""
,
description
=
"
LAMMPS molecular dynamics library
"
,
py_modules
=
[
"
lammps
"
]
py_modules
=
[
"
lammps
"
])
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment