Skip to content
Snippets Groups Projects
Commit 94314a6c authored by Andreas Dedner's avatar Andreas Dedner
Browse files

change _typeName and _includes to cppTypeName and cppIncludes

minor change to dune-py setup in corner case

reduce debug output a bit in the python dune generator

fix an issue with the dunepackaging script when called from installed dune.common
parent c763e5c2
No related branches found
No related tags found
1 merge request!960refactor the way python is used in dune
Pipeline #40596 passed with warnings
......@@ -23,7 +23,12 @@ mods = os.path.join(here, "..", "python", "dune")
sys.path.append(mods)
pythonpath = mods + ":" + os.environ.get('PYTHONPATH','.')
os.environ['PYTHONPATH'] = pythonpath
from packagemetadata import metaData
try:
from packagemetadata import metaData
except ImportError:
# not calling from within a dune-common source module so use installed
# version after all
from dune.packagemetadata import metaData
def main(argv):
......
add_executable(poosc08 "poosc08.cc")
target_link_libraries(poosc08 PUBLIC "dunecommon")
#add_executable(poosc08 "poosc08.cc")
#target_link_libraries(poosc08 PUBLIC "dunecommon")
add_executable(poosc08_test "poosc08_test.cc")
target_link_libraries(poosc08_test PUBLIC "dunecommon")
#add_executable(poosc08_test "poosc08_test.cc")
#target_link_libraries(poosc08_test PUBLIC "dunecommon")
add_executable(indexset "indexset.cc")
target_link_libraries(indexset PUBLIC "dunecommon")
#add_executable(indexset "indexset.cc")
#target_link_libraries(indexset PUBLIC "dunecommon")
add_dune_mpi_flags("poosc08;poosc08_test;indexset")
#add_dune_mpi_flags("poosc08;poosc08_test;indexset")
dune_add_latex_document(
SOURCE communication.tex
......
......@@ -6,7 +6,7 @@ from dune.common.utility import isString
def cppType(arg):
try:
t, i = arg._typeName + " &", arg._includes
t, i = arg.cppTypeName + " &", arg.cppIncludes
except AttributeError:
if isinstance(arg, bool):
t, i = "bool", []
......
......@@ -65,7 +65,10 @@ class Builder:
deps = description.depends
force = not modules == [d[0] for d in deps] # ignore version number in dependency for now
# todo also check if location of modules have changed to find
# modules moved from build to install - or tag that some other way
# modules moved from build to install or vice versa - or tag that some other way
# For now we simply always force a rebuild of the dune-py
# module which might lead to more work than required
force = True
else:
force = True
......@@ -141,9 +144,10 @@ class Builder:
cmake = subprocess.Popen( "cmake .".split(),
cwd=dunepy_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = cmake.communicate()
logger.debug("Build output: "+buffer_to_str(stdout))
if cmake.returncode > 0:
raise CompileError(buffer_to_str(stderr))
else:
logger.debug("Build output: "+buffer_to_str(stdout))
def __init__(self, force=False, saveOutput=False):
self.force = force
......@@ -180,7 +184,7 @@ class Builder:
open(tagfile, 'a').close()
else:
logger.debug('Using existing dune-py module in '+self.dune_py_dir)
self.compile()
self.compile(verbose=True)
comm.barrier()
try:
......@@ -189,7 +193,7 @@ class Builder:
dune.__path__.insert(0,os.path.join(self.dune_py_dir, 'python', 'dune'))
self.initialized = True
def compile(self, target='all'):
def compile(self, target='all', verbose=False):
cmake_command = dune.common.module.get_cmake_command()
cmake_args = [cmake_command, "--build", self.dune_py_dir,
"--target", target, "--parallel"]
......@@ -205,9 +209,10 @@ class Builder:
cmake_args += ["--"] + make_args
cmake = subprocess.Popen(cmake_args, cwd=self.generated_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = cmake.communicate()
logger.debug("Compiler output: "+buffer_to_str(stdout))
if cmake.returncode > 0:
raise CompileError(buffer_to_str(stderr))
elif verbose:
logger.debug("Compiler output: "+buffer_to_str(stdout))
writeOutput = self.savedOutput is not None and target != 'all' if self.skipTargetAll else self.savedOutput is not None
if writeOutput:
out = buffer_to_str(stdout)
......@@ -270,7 +275,7 @@ class Builder:
cmake = subprocess.Popen( "cmake .".split(),
cwd=self.dune_py_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = cmake.communicate()
logger.debug("Build output: "+buffer_to_str(stdout))
# logger.debug("Build output: "+buffer_to_str(stdout))
if cmake.returncode > 0:
raise CompileError(buffer_to_str(stderr))
except: # all exceptions will cause a problem here
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment