Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
dumux-repositories
dumux
Commits
97f3e63b
Commit
97f3e63b
authored
4 years ago
by
Farid Mohammadi
Committed by
Timo Koch
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[bin][installdumux] added python version of installdumux script
parent
a7a63bff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2150
Translate install script to Python
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/installdumux.py
+115
-0
115 additions, 0 deletions
bin/installdumux.py
with
115 additions
and
0 deletions
bin/installdumux.py
0 → 100755
+
115
−
0
View file @
97f3e63b
#!/usr/bin/env python3
"""
One click install script for dumux
"""
import
os
import
subprocess
from
distutils.spawn
import
find_executable
from
pkg_resources
import
parse_version
def
show_message
(
message
):
print
(
"
*
"
*
120
)
print
(
message
)
print
(
"
*
"
*
120
)
def
check_cpp_version
():
requiredversion
=
"
7
"
result
=
subprocess
.
check_output
([
"
g++
"
,
"
-dumpversion
"
]).
decode
().
strip
()
if
parse_version
(
result
)
<
parse_version
(
requiredversion
):
print
(
"
-- An error occured while checking for prerequistes.
"
)
raise
Exception
(
"
g++ greater than or equal to {} is required for dumux releases >=3.2!
"
.
format
(
requiredversion
))
def
git_clone
(
url
,
branch
=
None
):
clone
=
[
"
git
"
,
"
clone
"
]
if
branch
:
clone
+=
[
"
-b
"
,
branch
]
result
=
subprocess
.
run
([
*
clone
,
url
])
if
result
.
returncode
!=
0
:
print
(
"
-- Failed to clone the repositories. Look for repository-specific errors.
"
)
raise
Exception
(
result
.
stderr
)
#################################################################
#################################################################
## (1/3) Check some prerequistes
#################################################################
#################################################################
programs
=
[
'
wget
'
,
'
git
'
,
'
gcc
'
,
'
g++
'
,
'
cmake
'
,
'
pkg-config
'
]
show_message
(
"
(1/3) Checking all prerequistes:
"
+
"
"
.
join
(
programs
)
+
"
...
"
)
# check some prerequistes
for
program
in
programs
:
if
find_executable
(
program
)
is
None
:
print
(
"
-- An error occured while checking for prerequistes.
"
)
raise
Exception
(
"
Program {} has not been found.
"
.
format
(
program
))
if
find_executable
(
'
paraview
'
)
is
None
:
print
(
"
-- Warning: paraview seems to be missing. You may not be able to view simulation results!
"
)
check_cpp_version
()
show_message
(
"
(1/3) Step completed. All prerequistes found.
"
)
#################################################################
#################################################################
## (2/3) Clone modules
#################################################################
#################################################################
# make a new folder containing everything
os
.
makedirs
(
"
./DUMUX
"
,
exist_ok
=
True
)
os
.
chdir
(
"
DUMUX
"
)
show_message
(
"
(2/3) Cloning repositories. This may take a while. Make sure to be connected to the internet...
"
)
dune_version
=
2.7
dumux_version
=
3.2
# the core modules
for
module
in
[
'
common
'
,
'
geometry
'
,
'
grid
'
,
'
localfunctions
'
,
'
istl
'
]:
if
not
os
.
path
.
exists
(
"
dune-{}
"
.
format
(
module
)):
git_clone
(
'
https://gitlab.dune-project.org/core/dune-{}.git
'
.
format
(
module
),
"
releases/{}
"
.
format
(
dune_version
))
else
:
print
(
"
-- Skip cloning dune-{} because the folder already exists.
"
.
format
(
module
))
# dumux
if
not
os
.
path
.
exists
(
"
dumux
"
):
git_clone
(
'
https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
'
,
"
releases/{}
"
.
format
(
dumux_version
))
else
:
print
(
"
-- Skip cloning dumux because the folder already exists.
"
)
show_message
(
"
(2/3) Step completed. All repositories have been cloned into a containing folder.
"
)
#################################################################
#################################################################
## (3/3) Configure and build
#################################################################
#################################################################
show_message
(
"
(3/3) Configure and build dune modules and dumux using dunecontrol. This may take several minutes...
"
)
# run dunecontrol
if
not
os
.
path
.
isfile
(
"
cmake.opts
"
):
subprocess
.
run
([
"
wget
"
,
"
https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/raw/releases/3.2/cmake.opts
"
])
else
:
print
(
"
-- The file cmake.opts already exists. The existing file will be used to configure dumux.
"
)
result
=
subprocess
.
run
([
"
./dune-common/bin/dunecontrol
"
,
"
--opts=cmake.opts
"
,
"
all
"
])
if
result
.
returncode
!=
0
:
print
(
"
-- Failed to build the dune libaries.
"
)
raise
Exception
(
result
.
stderr
)
show_message
(
"
(3/3) Step completed. Succesfully configured and built dune and dumux.
"
)
#################################################################
#################################################################
## Show message how to check that everything works
#################################################################
#################################################################
show_message
(
"
(Installation complete) To test if everything works, please run the following commands (can be copied to command line):
\n\n
"
"
cd DUMUX/dumux/build-cmake/test/porousmediumflow/1p/implicit/isothermal
\n
"
"
make test_1p_tpfa
\n
"
"
./test_1p_tpfa
\n
"
"
paraview *pvd
\n
"
)
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