[SCons] Fix python_prefix/prefix handling for minimal Python module

Make the case where prefix is specified but python_prefix is not consistent
with how the full Python module is handled.

Fix a case where the minimal Python module could be installed to a directory
named literally 'python_prefix'.
This commit is contained in:
Ray Speth
2022-04-10 11:12:18 -04:00
parent 0d29d6a51c
commit 903c184fd2

View File

@@ -32,7 +32,6 @@ localenv.Depends(mod, [make_setup, readme, license, "setup.py", "pyproject.toml"
install_cmd = ["$python_cmd_esc", "-m", "pip", "install"]
user_install = False
python_prefix = None
python_root = None
if localenv["PYTHON_INSTALLER"] == "direct":
if localenv["python_prefix"] == "USER":
# Install to the OS-dependent user site-packages directory
@@ -40,9 +39,12 @@ if localenv["PYTHON_INSTALLER"] == "direct":
user_install = True
elif localenv["python_prefix"]:
# A specific location for the Cantera python module has been given
install_cmd.extend((f"--prefix={localenv.subst('python_prefix')}",
install_cmd.extend((f"--prefix={localenv.subst('$python_prefix')}",
"--no-warn-script-location"))
python_prefix = localenv.subst("python_prefix")
python_prefix = localenv.subst("$python_prefix")
elif not env["default_prefix"]:
install_cmd.append(f"--prefix={env['prefix']}")
python_prefix = env["prefix"]
if env["stage_dir"]:
# Get the absolute path to the stage directory. If the stage directory is a relative