Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91117800
Install.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 8, 02:32
Size
1 KB
Mime Type
text/x-python
Expires
Sun, Nov 10, 02:32 (2 d)
Engine
blob
Format
Raw Data
Handle
22199971
Attached To
rLAMMPS lammps
Install.py
View Options
#!/usr/bin/env python
# install.py tool to do build of the linear algebra library
# used to automate the steps described in the README file in this dir
import
sys
,
commands
,
os
# help message
help
=
"""
Syntax: python Install.py -m machine
-m = peform a clean followed by "make -f Makefile.machine"
machine = suffix of a lib/Makefile.* file
"""
# print error message or help
def
error
(
str
=
None
):
if
not
str
:
print
help
else
:
print
"ERROR"
,
str
sys
.
exit
()
# parse args
args
=
sys
.
argv
[
1
:]
nargs
=
len
(
args
)
if
nargs
==
0
:
error
()
machine
=
None
iarg
=
0
while
iarg
<
nargs
:
if
args
[
iarg
]
==
"-m"
:
if
iarg
+
2
>
nargs
:
error
()
machine
=
args
[
iarg
+
1
]
iarg
+=
2
else
:
error
()
# set lib from working dir
cwd
=
os
.
getcwd
()
lib
=
os
.
path
.
basename
(
cwd
)
# make the library
print
"Building lib
%s
.a ..."
%
lib
cmd
=
"make -f Makefile.
%s
clean; make -f Makefile.
%s
"
%
(
machine
,
machine
)
txt
=
commands
.
getoutput
(
cmd
)
print
txt
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
))
Event Timeline
Log In to Comment