Commit 952f7cb2 authored by Andreas Dedner's avatar Andreas Dedner

improved usage of alternative builddir in setup script - added a

--builddir parameter and correctly use environment variable
parent 734898cd
Pipeline #12478 passed with stage
in 13 minutes and 58 seconds
from __future__ import print_function
import sys
try:
from dune.common.module import *
except ImportError:
import os
here = os.path.dirname(os.path.abspath(__file__))
mods = os.path.join(os.path.dirname(here), "python", "dune", "common")
if os.path.exists(os.path.join(mods, "module.py")):
sys.path.append(mods)
from module import *
else:
raise
definitions={}
for arg in sys.argv[1:]:
key, value = arg.split('=',1)
definitions[key] = value
modules, dirs = select_modules()
deps = resolve_dependencies(modules)
order = resolve_order(deps)
prefix = {}
for name in order:
dir = dirs[name]
if is_installed(dir, name):
prefix[name] = get_prefix(name)
else:
builddir = default_build_dir(dir, name)
print("Going to build " + name + "...")
output = configure_module(dir, builddir, {d: prefix[d] for d in deps[name]}, definitions)
print(output)
output = build_module(builddir)
prefix[name] = builddir
......@@ -89,7 +89,7 @@ def main(argv):
shutil.rmtree(dunepy)
foundModule = make_dune_py_module(dunepy)
output = build_dune_py_module(dunepy, definitions)
output = build_dune_py_module(dunepy, definitions, None, builddir)
print("CMake output")
print(output)
......
......@@ -388,8 +388,9 @@ def select_modules(modules=None):
return (desc, dir)
def default_build_dir(srcdir, module=None):
builddir = os.environ.get('DUNE_BUILDDIR', 'build-cmake')
def default_build_dir(srcdir, module=None, builddir=None):
if builddir is None:
builddir = os.environ.get('DUNE_BUILDDIR', 'build-cmake')
if os.path.isabs(builddir):
if module is None:
......@@ -551,7 +552,7 @@ def make_dune_py_module(dune_py_dir=None):
logger.info('Using existing dune-py module in ' + dune_py_dir)
def build_dune_py_module(dune_py_dir=None, definitions=None, build_args=None):
def build_dune_py_module(dune_py_dir=None, definitions=None, build_args=None, builddir=None):
if dune_py_dir is None:
dune_py_dir = get_dune_py_dir()
if definitions is None:
......@@ -567,7 +568,7 @@ def build_dune_py_module(dune_py_dir=None, definitions=None, build_args=None):
if is_installed(dir, name):
prefix[name] = get_prefix(name)
else:
prefix[name] = default_build_dir(dir, name)
prefix[name] = default_build_dir(dir, name, builddir)
output = configure_module(dune_py_dir, dune_py_dir, {d: prefix[d] for d in deps}, definitions)
output += build_module(dune_py_dir, build_args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment