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
355aad96
Commit
355aad96
authored
7 years ago
by
Axel Kohlmeyer
Browse files
Options
Downloads
Patches
Plain Diff
restore python3 support. this now can run with python 2.7.13 and 3.5.3.
parent
ec42a605
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/kim/Install.py
+13
-32
13 additions, 32 deletions
lib/kim/Install.py
with
13 additions
and
32 deletions
lib/kim/Install.py
+
13
−
32
View file @
355aad96
...
@@ -87,14 +87,15 @@ url = "https://s3.openkim.org/kim-api/%s.tgz" % version
...
@@ -87,14 +87,15 @@ url = "https://s3.openkim.org/kim-api/%s.tgz" % version
if
buildflag
:
if
buildflag
:
# set install directory
# set install directory
dir
=
os
.
path
.
join
(
os
.
path
.
abspath
(
dir
),
"
installed-
"
+
version
)
dir
=
os
.
path
.
join
(
os
.
path
.
abspath
(
dir
),
"
installed-
"
+
version
)
# check to see if an installed kim-api already exists
# check to see if an installed kim-api already exists
and wipe it out.
if
os
.
path
.
isdir
(
dir
):
if
os
.
path
.
isdir
(
dir
):
print
(
"
kim-api is already installed at %s
"
%
dir
)
print
(
"
kim-api is already installed at %s
.
\n
Removing it for re-install
"
%
dir
)
print
(
"
Must remove this directory in order to resintall at this location
"
)
cmd
=
"
rm -rf %s
"
%
dir
sys
.
exit
(
)
subprocess
.
check_output
(
cmd
,
shell
=
True
)
# configure LAMMPS to use kim-api to be installed
# configure LAMMPS to use kim-api to be installed
...
@@ -110,19 +111,9 @@ if buildflag:
...
@@ -110,19 +111,9 @@ if buildflag:
print
(
"
Created %s/Makefile.KIM_DIR : using %s
"
%
(
thisdir
,
dir
))
print
(
"
Created %s/Makefile.KIM_DIR : using %s
"
%
(
thisdir
,
dir
))
# download entire kim-api tarball
# download entire kim-api tarball
# try first via urllib
# if fails (probably due to no SSL support), use wget
print
(
"
Downloading kim-api tarball ...
"
)
print
(
"
Downloading kim-api tarball ...
"
)
geturl
(
url
,
"
%s/%s.tgz
"
%
(
thisdir
,
version
))
try
:
geturl
(
url
,
"
%s/%s.tgz
"
%
(
thisdir
,
version
))
except
:
cmd
=
"
wget %s %s/%s.tgz
"
%
(
url
,
thisdir
,
version
)
subprocess
.
check_output
(
cmd
,
shell
=
True
)
if
not
os
.
path
.
isfile
(
"
%s/%s.tgz
"
%
(
thisdir
,
version
)):
print
(
"
Both urllib and wget command failed to download
"
)
sys
.
exit
()
print
(
"
Unpacking kim-api tarball ...
"
)
print
(
"
Unpacking kim-api tarball ...
"
)
cmd
=
"
cd %s; rm -rf %s; tar zxvf %s.tgz
"
%
(
thisdir
,
version
,
version
)
cmd
=
"
cd %s; rm -rf %s; tar zxvf %s.tgz
"
%
(
thisdir
,
version
,
version
)
subprocess
.
check_output
(
cmd
,
shell
=
True
)
subprocess
.
check_output
(
cmd
,
shell
=
True
)
...
@@ -182,17 +173,8 @@ if addflag:
...
@@ -182,17 +173,8 @@ if addflag:
# if fails (probably due to no SSL support), use wget
# if fails (probably due to no SSL support), use wget
print
(
"
Downloading item tarball ...
"
)
print
(
"
Downloading item tarball ...
"
)
url
=
"
https://openkim.org/download/%s.tgz
"
%
addmodelname
url
=
"
https://openkim.org/download/%s.tgz
"
%
addmodelname
geturl
(
url
,
"
%s/%s.tgz
"
%
(
thisdir
,
addmodelname
))
try
:
geturl
(
url
,
"
%s/%s.tgz
"
%
(
thisdir
,
addmodelname
))
except
:
cmd
=
"
wget %s %s/%s.tgz
"
%
(
url
,
thisdir
,
addmodelname
)
txt
=
subprocess
.
check_output
(
cmd
,
shell
=
True
)
print
(
txt
[
1
])
if
not
os
.
path
.
isfile
(
"
%s/%s.tgz
"
%
(
thisdir
,
addmodelname
)):
print
(
"
Both urllib.urlretrieve() and wget command failed to download
"
)
sys
.
exit
()
print
(
"
Unpacking item tarball ...
"
)
print
(
"
Unpacking item tarball ...
"
)
cmd
=
"
cd %s; tar zxvf %s.tgz
"
%
(
thisdir
,
addmodelname
)
cmd
=
"
cd %s; tar zxvf %s.tgz
"
%
(
thisdir
,
addmodelname
)
...
@@ -205,19 +187,19 @@ if addflag:
...
@@ -205,19 +187,19 @@ if addflag:
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
# Error: but first, check to see if it needs a driver
# Error: but first, check to see if it needs a driver
firstRunOutput
=
e
.
output
.
decode
()
firstRunOutput
=
e
.
output
cmd
=
"
cd %s/%s; make kim-item-type
"
%
(
thisdir
,
addmodelname
)
cmd
=
"
cd %s/%s; make kim-item-type
"
%
(
thisdir
,
addmodelname
)
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
txt
=
txt
.
decode
().
strip
()
if
txt
==
"
ParameterizedModel
"
:
if
txt
==
"
ParameterizedModel
"
:
# Get and install driver
# Get and install driver
cmd
=
"
cd %s/%s; make model-driver-name
"
%
(
thisdir
,
addmodelname
)
cmd
=
"
cd %s/%s; make model-driver-name
"
%
(
thisdir
,
addmodelname
)
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
adddrivername
=
txt
adddrivername
=
txt
.
decode
().
strip
()
print
(
"
First
I
nstalling model driver: %s
"
%
adddrivername
)
print
(
"
First
i
nstalling model driver: %s
"
%
adddrivername
)
cmd
=
"
cd %s; python Install.py -a %s
"
%
(
thisdir
,
adddrivername
)
cmd
=
"
cd %s; python Install.py -a %s
"
%
(
thisdir
,
adddrivername
)
try
:
try
:
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
...
@@ -225,17 +207,16 @@ if addflag:
...
@@ -225,17 +207,16 @@ if addflag:
print
(
e
.
output
)
print
(
e
.
output
)
sys
.
exit
()
sys
.
exit
()
print
(
txt
)
# now install the model that needed the driver
# now install the model that needed the driver
print
(
"
Now installing model : %s
"
%
addmodelname
)
cmd
=
"
cd %s; python Install.py -a %s
"
%
(
thisdir
,
addmodelname
)
cmd
=
"
cd %s; python Install.py -a %s
"
%
(
thisdir
,
addmodelname
)
try
:
try
:
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
print
(
e
.
output
)
print
(
e
.
output
)
sys
.
exit
()
sys
.
exit
()
print
(
txt
)
print
(
txt
.
decode
()
)
sys
.
exit
()
sys
.
exit
()
else
:
else
:
print
(
firstRunOutput
)
print
(
firstRunOutput
)
...
...
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