Skip to content

Commit

Permalink
Get ExtensibleRate to work on Windows GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Sep 11, 2022
1 parent dc36ad3 commit 61f2688
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 8 additions & 3 deletions site_scons/buildutils.py
Expand Up @@ -1260,11 +1260,13 @@ def setup_python_env(env):
import numpy
import json
import site
import sys
vars = get_config_vars()
vars["plat"] = get_platform()
vars["numpy_include"] = numpy.get_include()
vars["site_packages"] = [d for d in site.getsitepackages() if d.endswith("-packages")]
vars["user_site_packages"] = site.getusersitepackages()
vars["abiflags"] = getattr(sys, "abiflags", "")
print(json.dumps(vars))
""")
_python_info = json.loads(get_command_output(env["python_cmd"], "-c", script))
Expand Down Expand Up @@ -1298,10 +1300,13 @@ def setup_python_env(env):
env["site_packages"] = info["site_packages"]
env["user_site_packages"] = info["user_site_packages"]
if env["OS"] != "Windows":
env["py_libpl"] = info["LIBPL"]
env["py_libpath"] = info["LIBPL"]
py_lib = "python" + info["py_version_short"] + info["abiflags"]
else:
env["py_libpl"] = info["installed_base"] + "\\libs"
env["py_libs"] = info.get("LIBS", "")
env["py_libpath"] = info["installed_base"] + "\\libs"
py_lib = "python" + py_version_nodot
env["py_libs"] = [py_lib] + [lib[2:] for lib in info.get("LIBS", "").split()
if lib.startswith("-l")]

# Don't print deprecation warnings for internal Python changes.
# Only applies to Python 3.8. The field that is deprecated in Python 3.8
Expand Down
9 changes: 5 additions & 4 deletions src/SConscript
Expand Up @@ -75,6 +75,7 @@ for subdir, extensions, setup in libs:
if env["python_package"] == "full":
pyenv = setup_python_env(localenv.Clone())
pyenv.PrependENVPath('PYTHONPATH', Dir('#interfaces/cython').abspath)
pyenv['PCH'] = '' # ignore precompiled header here
build_dir = Path(Dir('#build').abspath).as_posix()
cythonized = pyenv.Command(
["extensions/pythonExtensions.cpp", "extensions/pythonExtensions.h"],
Expand All @@ -90,10 +91,10 @@ if env["python_package"] == "full":
Copy('$TARGET', '$SOURCE'))
libraryTargets.append(obj)
libraryTargets.append(pyenv.SharedObject("extensions/PythonExtensionManager.cpp"))
libpython = pyenv.subst("python${py_version_short}")
localenv.Append(LIBS=libpython, LIBPATH=pyenv["py_libpl"], LDFLAGS=pyenv["py_libs"])
env["cantera_libs"].append(libpython)

localenv.Append(LIBS=pyenv["py_libs"], LIBPATH=pyenv["py_libpath"])
env["cantera_libs"].extend(pyenv["py_libs"])
env.Append(LIBPATH=pyenv["py_libpath"])
env["extra_lib_dirs"].append(pyenv["py_libpath"])

# build the Cantera static library
lib = build(localenv.StaticLibrary('../lib/cantera', libraryTargets,
Expand Down

0 comments on commit 61f2688

Please sign in to comment.