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
d8a6a26d
Commit
d8a6a26d
authored
3 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[python] Use metadata file to find properties.hh if available
parent
c17e03aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2934
[python] Make bindings work with dune 2.9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/CMakeLists.txt
+9
-0
9 additions, 0 deletions
python/CMakeLists.txt
python/dumux/common/properties.py
+38
-3
38 additions, 3 deletions
python/dumux/common/properties.py
with
47 additions
and
3 deletions
python/CMakeLists.txt
+
9
−
0
View file @
d8a6a26d
add_subdirectory
(
dumux
)
configure_file
(
setup.py.in setup.py
)
# link properties.hh needed by the Python bindings
# to determine the list of properties
# create copy for Windows and symlink otherwise
if
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Windows"
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
"-E"
"copy"
"
${
CMAKE_SOURCE_DIR
}
/dumux/common/properties.hh"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/properties.hh"
)
else
()
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
"-E"
"create_symlink"
"
${
CMAKE_SOURCE_DIR
}
/dumux/common/properties.hh"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/properties.hh"
)
endif
()
This diff is collapsed.
Click to expand it.
python/dumux/common/properties.py
+
38
−
3
View file @
d8a6a26d
...
...
@@ -7,6 +7,7 @@ import os
from
dataclasses
import
dataclass
from
typing
import
List
,
Union
from
dune.common.hashit
import
hashIt
import
dumux
@dataclass
...
...
@@ -146,12 +147,46 @@ def listTypeTags():
print
(
"
\n
**********************************
"
)
def
predefinedProperties
():
"""
Create a list of properties defined in properties.hh
"""
def
propertiesHeaderPath
():
"""
Find the path to the properties.hh C++ header
"""
path
,
_
=
os
.
path
.
split
(
dumux
.
__file__
)
metaDataFile
=
os
.
path
.
join
(
path
,
"
data/metadata.cmake
"
)
if
os
.
path
.
exists
(
metaDataFile
):
data
=
{}
with
open
(
metaDataFile
,
"
r
"
)
as
metaData
:
for
line
in
metaData
:
try
:
key
,
value
=
line
.
split
(
"
=
"
,
1
)
data
[
key
]
=
value
.
strip
()
except
ValueError
:
# no '=' in line
pass
return
os
.
path
.
abspath
(
os
.
path
.
join
(
data
[
"
DEPBUILDDIRS
"
].
split
(
"
;
"
)[
0
],
"
python
"
,
"
properties.hh
"
,
)
)
# as fall-back try relative path
propertiesHeader
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)
+
"
/../../../../dumux/common/properties.hh
"
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
../../../../dumux/common/properties.hh
"
,
)
)
if
os
.
path
.
exists
(
propertiesHeader
):
return
propertiesHeader
raise
RuntimeError
(
"
Could not find properties.hh header
"
)
def
predefinedProperties
():
"""
Create a list of properties defined in properties.hh
"""
propertiesHeader
=
propertiesHeaderPath
()
with
open
(
propertiesHeader
,
encoding
=
"
utf-8
"
)
as
header
:
properties
=
[]
for
line
in
header
:
...
...
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