wesnoth/scons/python_devel.py
Sergey Popov 51f18a2a02 Added python imports that for some reason are required on windows...
...but not on linux.

Append PROGSUFFIX when copying binaries to wesnoth root.
2008-05-08 11:22:15 +00:00

35 lines
1.1 KiB
Python

# vi: syntax=python:et:ts=4
import sys, os
from config_check_utils import *
def CheckPython(context):
env = context.env
backup = backup_env(env, ["CPPPATH", "LIBPATH", "LIBS"])
context.Message("Checking for Python... ")
import distutils.sysconfig
env.AppendUnique(CPPPATH = distutils.sysconfig.get_python_inc())
version = distutils.sysconfig.get_config_var("VERSION")
if not version:
version = sys.version[:3]
if env["PLATFORM"] == "win32":
version = version.replace('.', '')
env.AppendUnique(LIBPATH = distutils.sysconfig.get_config_var("LIBDIR") or \
os.path.join(distutils.sysconfig.get_config_var("prefix"), "libs") )
env.AppendUnique(LIBS = "python" + version)
test_program = """
#include <Python.h>
int main()
{
Py_Initialize();
}
\n"""
if context.TryLink(test_program, ".c"):
context.Result("yes")
return True
else:
context.Result("no")
restore_env(context.env, backup)
return False
config_checks = { "CheckPython" : CheckPython }