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
715c797d
Commit
715c797d
authored
7 years ago
by
Axel Kohlmeyer
Browse files
Options
Downloads
Patches
Plain Diff
simplify Install.py for voronoi
parent
fd6e11f8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/voronoi/.gitignore
+4
-0
4 additions, 0 deletions
lib/voronoi/.gitignore
lib/voronoi/Install.py
+37
-39
37 additions, 39 deletions
lib/voronoi/Install.py
lib/voronoi/README
+1
-1
1 addition, 1 deletion
lib/voronoi/README
with
42 additions
and
40 deletions
lib/voronoi/.gitignore
0 → 100644
+
4
−
0
View file @
715c797d
# files to ignore
/liblink
/includelink
/voro++-*
This diff is collapsed.
Click to expand it.
lib/voronoi/Install.py
+
37
−
39
View file @
715c797d
...
...
@@ -10,27 +10,23 @@ except: from urllib import urlretrieve as geturl
# help message
help
=
"""
Syntax from src dir: make lib-voronoi args=
"
-v version -h hpath hdir -g -b -l
"
Syntax from lib dir: python Install.py -v version -h hpath hdir -g -b -l
Syntax from src dir: make lib-voronoi
or: make lib-voronoi args=
"
-p /usr/local/voro++-0.4.6
"
or: make lib-voronoi args=
"
-v voro++-0.4.6 -b
"
Syntax from lib dir: python Install.py -v voro++-0.4.6 -b
or: python Install.py
or: python Install.py -p /usr/local/voro++-0.4.6
specify one or more options, order does not matter
-b = download and build the Voro++ library (default)
-p = specify folder of existing Voro++ installation
-v = version of Voro++ to download and build
default version = voro++-0.4.6 (current as of Jan 2015)
-h = set home dir of Voro++ to be hpath/hdir
hpath can be full path, contain
'
~
'
or
'
.
'
chars
default hpath = . = lib/voronoi
default hdir = voro++-0.4.6 = what tarball unpacks to
-g = grab (download) tarball from math.lbl.gov/voro++ website
unpack it to hpath/hdir
hpath must already exist
if hdir already exists, it will be deleted before unpack
-b = build Voro++ library in its src dir
-l = create 2 softlinks (includelink,liblink) in lib/voronoi to Voro++ src dir
Example:
make lib-voronoi args=
"
-
g -b -l
"
# download/build in lib/voronoi/voro++-0.4.6
make lib-voronoi args=
"
-
b
"
# download/build in lib/voronoi/voro++-0.4.6
"""
# settings
...
...
@@ -47,10 +43,10 @@ def error(str=None):
# expand to full path name
# process leading '~' or relative path
def
fullpath
(
path
):
return
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
path
))
# parse args
args
=
sys
.
argv
[
1
:]
...
...
@@ -60,9 +56,10 @@ if nargs == 0: error()
homepath
=
"
.
"
homedir
=
version
grabflag
=
False
buildflag
=
False
linkflag
=
False
grabflag
=
True
buildflag
=
True
pathflag
=
False
linkflag
=
True
iarg
=
0
while
iarg
<
nargs
:
...
...
@@ -70,42 +67,43 @@ while iarg < nargs:
if
iarg
+
2
>
nargs
:
error
()
version
=
args
[
iarg
+
1
]
iarg
+=
2
elif
args
[
iarg
]
==
"
-h
"
:
if
iarg
+
3
>
nargs
:
error
()
homepath
=
args
[
iarg
+
1
]
homedir
=
args
[
iarg
+
2
]
iarg
+=
3
elif
args
[
iarg
]
==
"
-g
"
:
grabflag
=
True
iarg
+=
1
elif
args
[
iarg
]
==
"
-p
"
:
if
iarg
+
2
>
nargs
:
error
()
voropath
=
fullpath
(
args
[
iarg
+
1
])
pathflag
=
True
buildflag
=
False
iarg
+=
2
elif
args
[
iarg
]
==
"
-b
"
:
buildflag
=
True
iarg
+=
1
elif
args
[
iarg
]
==
"
-l
"
:
linkflag
=
True
iarg
+=
1
else
:
error
()
homepath
=
fullpath
(
homepath
)
if
not
os
.
path
.
isdir
(
homepath
):
error
(
"
Voro++ path does not exist
"
)
homedir
=
"
%s/%s
"
%
(
homepath
,
homedir
)
homedir
=
"
%s/%s
"
%
(
homepath
,
version
)
if
(
pathflag
):
if
not
os
.
path
.
isdir
(
voropath
):
error
(
"
Voro++ path does not exist
"
)
homedir
=
voropath
if
(
buildflag
and
pathflag
):
error
(
"
Cannot use -b and -p flag at the same time
"
)
# download and unpack Voro++ tarball
if
grabflag
:
print
(
"
Downloading Voro++ ...
"
)
geturl
(
url
,
"
%s/%s.tar.gz
"
%
(
homepath
,
version
))
print
(
"
Unpacking Voro++ tarball ...
"
)
if
os
.
path
.
exists
(
"
%s/%s
"
%
(
homepath
,
version
)):
cmd
=
'
rm -rf
"
%s/%s
"'
%
(
homepath
,
version
)
subprocess
.
check_output
(
cmd
,
shell
=
True
)
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
cmd
=
'
cd
"
%s
"
; tar -xzvf %s.tar.gz
'
%
(
homepath
,
version
)
subprocess
.
check_output
(
cmd
,
shell
=
True
)
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
if
os
.
path
.
basename
(
homedir
)
!=
version
:
if
os
.
path
.
exists
(
homedir
):
cmd
=
'
rm -rf
"
%s
"'
%
homedir
subprocess
.
check_output
(
cmd
,
shell
=
True
)
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
os
.
rename
(
"
%s/%s
"
%
(
homepath
,
version
),
homedir
)
# build Voro++
...
...
@@ -113,8 +111,8 @@ if grabflag:
if
buildflag
:
print
(
"
Building Voro++ ...
"
)
cmd
=
'
cd
"
%s
"
; make
'
%
homedir
txt
=
subprocess
.
check_output
(
cmd
,
shell
=
True
)
print
(
txt
)
txt
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
print
(
txt
.
decode
(
'
UTF-8
'
)
)
# create 2 links in lib/voronoi to Voro++ src dir
...
...
@@ -125,6 +123,6 @@ if linkflag:
if
os
.
path
.
isfile
(
"
liblink
"
)
or
os
.
path
.
islink
(
"
liblink
"
):
os
.
remove
(
"
liblink
"
)
cmd
=
[
'
ln -s
"
%s/src
"
includelink
'
%
homedir
,
'
includelink
'
]
subprocess
.
check_output
(
cmd
,
shell
=
True
)
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
cmd
=
[
'
ln -s
"
%s/src
"
liblink
'
%
homedir
]
subprocess
.
check_output
(
cmd
,
shell
=
True
)
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
This diff is collapsed.
Click to expand it.
lib/voronoi/README
+
1
−
1
View file @
715c797d
...
...
@@ -22,7 +22,7 @@ Instructions:
or somewhere else on your system.
2. compile Voro++ from within its home directory
% make
% make
3. There is no need to install Voro++ if you only wish
to use it from LAMMPS. You can install it if you
...
...
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