Skip to content

Commit

Permalink
[SCons] Redirect conda destination if 'stage_dir' is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Feb 11, 2022
1 parent 1632f99 commit 4e9c2b9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ except subprocess.CalledProcessError:
env["git_commit"] = "unknown"

# Print values of all build options:
# the (updated) "cantera.conf" combines all options that were specified by the user
cantera_conf = Path("cantera.conf").read_text()
logger.info("Configuration variables read from 'cantera.conf' and command line:")
logger.info(textwrap.indent(cantera_conf, " "), print_level=False)
Expand Down Expand Up @@ -1642,17 +1643,16 @@ if env['matlab_toolbox'] == 'y':
# /usr/local because of dist-packages vs site-packages
env['debian'] = any(name.endswith('dist-packages') for name in sys.path)

# identify options selected either on command line or in cantera.conf
selected_options = set(line.split("=")[0].strip()
for line in cantera_conf.splitlines())

# Check whether Cantera should be installed into a conda environment
if conda_prefix is not None:
if env["layout"] != "conda":
# identify options selected either on command line or in cantera.conf
selected_options = set(line.split("=")[0].strip()
for line in cantera_conf.splitlines())
use_conda = (
not selected_options &
{"layout", "prefix", "python_prefix", "python_cmd"})
use_conda &= sys.executable.startswith(conda_prefix)
if use_conda:
if env["layout"] != "conda" and sys.executable.startswith(conda_prefix):
# use conda layout unless any 'blocking' options were specified
blocking_options = {"layout", "prefix", "python_prefix", "python_cmd"}
if not selected_options & blocking_options:
env["layout"] = "conda"
logger.info(
f"Using conda environment as default 'prefix': {conda_prefix}")
Expand All @@ -1663,7 +1663,8 @@ elif env["layout"] == "conda":
# Directories where things will be after actually being installed. These
# variables are the ones that are used to populate header files, scripts, etc.
if env["layout"] == "conda":
env["prefix"] = os.path.normpath(conda_prefix)
if "stage_dir" not in selected_options:
env["prefix"] = os.path.normpath(conda_prefix)

if env["layout"] == "conda" and os.name == "nt":
env["ct_libdir"] = pjoin(env["prefix"], "Library", env["libdirname"])
Expand Down

0 comments on commit 4e9c2b9

Please sign in to comment.