#!/usr/bin/python
# Project: Soar <http://soar.googlecode.com>
# Author: Jonathan Voigt <voigtjr@gmail.com>
#
import distutils.sysconfig as sysconfig
import os, os.path, sys
import SCons.Script
from ast import literal_eval
from subprocess import check_output

Import('env')
clone = env.Clone()
clone['SWIGPATH'] = clone['CPPPATH']
clone['SWIGFLAGS'] = ['-c++', '-python']
if GetOption('nosvs'):
    clone['SWIGFLAGS'].append('-DNO_SVS')
python_sml_alias = clone['SML_PYTHON_ALIAS']

python_exe = GetOption('python')
if os.name == 'nt':
    commands = ("distutils.sysconfig.get_python_inc()",
                "os.path.join(distutils.sysconfig.get_config_vars('BINDIR')[0], 'libs')",
                "'python' + distutils.sysconfig.get_config_vars('VERSION')[0]")
else:
    commands = ("distutils.sysconfig.get_python_inc()",
                "distutils.sysconfig.get_config_vars('LIBDIR')",
                "distutils.sysconfig.get_config_vars('LIBRARY')[0]")
command = """
import distutils.sysconfig;
import os.path;
print(tuple([{}]));
""".format(", ".join(commands))

lib_install_dir = clone['OUT_DIR']
inc_path, lib_path, pylib = literal_eval(check_output((python_exe, "-c", command)).decode())

if isinstance(lib_path, list):
    lib_path = lib_path[0]

clone.Append(CPPPATH = inc_path, LIBPATH = lib_path, LIBS = pylib)

if os.name == 'posix':
    clone.Append(CPPFLAGS = Split('-Wno-unused -fno-strict-aliasing'))

if sys.platform == 'darwin':
    clone.Replace(SHLINKFLAGS = Split('$LINKFLAGS -bundle -flat_namespace -undefined suppress'))
    clone.Replace(SHLIBSUFFIX = ['.so'])

name = 'Python_sml_ClientInterface'
interface = env.File(name + '.i')
source = env.File(name + '.py')

if os.name == 'nt':
    # the [:1] at the end throws away the .exp and .lib files that are generated
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX = '_', SHLIBSUFFIX = '.pyd')[:1]
else:
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX = '_')
install_source = env.Install(lib_install_dir, source)
install_lib = env.Install(lib_install_dir, shlib)
install_test = env.Install(lib_install_dir, env.File('TestPythonSML.py'))

env.Alias(python_sml_alias, install_lib + install_source + install_test)

649861442a8182c20e68619b1fffe6aa0cd94d6e
<mask token>

<mask token>
Import('env')
<mask token>
if GetOption('nosvs'):
    clone['SWIGFLAGS'].append('-DNO_SVS')
<mask token>
if os.name == 'nt':
    commands = ('distutils.sysconfig.get_python_inc()',
        "os.path.join(distutils.sysconfig.get_config_vars('BINDIR')[0], 'libs')"
        , "'python' + distutils.sysconfig.get_config_vars('VERSION')[0]")
else:
    commands = ('distutils.sysconfig.get_python_inc()',
        "distutils.sysconfig.get_config_vars('LIBDIR')",
        "distutils.sysconfig.get_config_vars('LIBRARY')[0]")
<mask token>
if isinstance(lib_path, list):
    lib_path = lib_path[0]
clone.Append(CPPPATH=inc_path, LIBPATH=lib_path, LIBS=pylib)
if os.name == 'posix':
    clone.Append(CPPFLAGS=Split('-Wno-unused -fno-strict-aliasing'))
if sys.platform == 'darwin':
    clone.Replace(SHLINKFLAGS=Split(
        '$LINKFLAGS -bundle -flat_namespace -undefined suppress'))
    clone.Replace(SHLIBSUFFIX=['.so'])
<mask token>
if os.name == 'nt':
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX='_',
        SHLIBSUFFIX='.pyd')[:1]
else:
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX='_')
<mask token>
env.Alias(python_sml_alias, install_lib + install_source + install_test)

<mask token>
Import('env')
clone = env.Clone()
clone['SWIGPATH'] = clone['CPPPATH']
clone['SWIGFLAGS'] = ['-c++', '-python']
if GetOption('nosvs'):
    clone['SWIGFLAGS'].append('-DNO_SVS')
python_sml_alias = clone['SML_PYTHON_ALIAS']
python_exe = GetOption('python')
if os.name == 'nt':
    commands = ('distutils.sysconfig.get_python_inc()',
        "os.path.join(distutils.sysconfig.get_config_vars('BINDIR')[0], 'libs')"
        , "'python' + distutils.sysconfig.get_config_vars('VERSION')[0]")
else:
    commands = ('distutils.sysconfig.get_python_inc()',
        "distutils.sysconfig.get_config_vars('LIBDIR')",
        "distutils.sysconfig.get_config_vars('LIBRARY')[0]")
command = (
    """
import distutils.sysconfig;
import os.path;
print(tuple([{}]));
"""
    .format(', '.join(commands)))
lib_install_dir = clone['OUT_DIR']
inc_path, lib_path, pylib = literal_eval(check_output((python_exe, '-c',
    command)).decode())
if isinstance(lib_path, list):
    lib_path = lib_path[0]
clone.Append(CPPPATH=inc_path, LIBPATH=lib_path, LIBS=pylib)
if os.name == 'posix':
    clone.Append(CPPFLAGS=Split('-Wno-unused -fno-strict-aliasing'))
if sys.platform == 'darwin':
    clone.Replace(SHLINKFLAGS=Split(
        '$LINKFLAGS -bundle -flat_namespace -undefined suppress'))
    clone.Replace(SHLIBSUFFIX=['.so'])
name = 'Python_sml_ClientInterface'
interface = env.File(name + '.i')
source = env.File(name + '.py')
if os.name == 'nt':
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX='_',
        SHLIBSUFFIX='.pyd')[:1]
else:
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX='_')
install_source = env.Install(lib_install_dir, source)
install_lib = env.Install(lib_install_dir, shlib)
install_test = env.Install(lib_install_dir, env.File('TestPythonSML.py'))
env.Alias(python_sml_alias, install_lib + install_source + install_test)

import distutils.sysconfig as sysconfig
import os, os.path, sys
import SCons.Script
from ast import literal_eval
from subprocess import check_output
Import('env')
clone = env.Clone()
clone['SWIGPATH'] = clone['CPPPATH']
clone['SWIGFLAGS'] = ['-c++', '-python']
if GetOption('nosvs'):
    clone['SWIGFLAGS'].append('-DNO_SVS')
python_sml_alias = clone['SML_PYTHON_ALIAS']
python_exe = GetOption('python')
if os.name == 'nt':
    commands = ('distutils.sysconfig.get_python_inc()',
        "os.path.join(distutils.sysconfig.get_config_vars('BINDIR')[0], 'libs')"
        , "'python' + distutils.sysconfig.get_config_vars('VERSION')[0]")
else:
    commands = ('distutils.sysconfig.get_python_inc()',
        "distutils.sysconfig.get_config_vars('LIBDIR')",
        "distutils.sysconfig.get_config_vars('LIBRARY')[0]")
command = (
    """
import distutils.sysconfig;
import os.path;
print(tuple([{}]));
"""
    .format(', '.join(commands)))
lib_install_dir = clone['OUT_DIR']
inc_path, lib_path, pylib = literal_eval(check_output((python_exe, '-c',
    command)).decode())
if isinstance(lib_path, list):
    lib_path = lib_path[0]
clone.Append(CPPPATH=inc_path, LIBPATH=lib_path, LIBS=pylib)
if os.name == 'posix':
    clone.Append(CPPFLAGS=Split('-Wno-unused -fno-strict-aliasing'))
if sys.platform == 'darwin':
    clone.Replace(SHLINKFLAGS=Split(
        '$LINKFLAGS -bundle -flat_namespace -undefined suppress'))
    clone.Replace(SHLIBSUFFIX=['.so'])
name = 'Python_sml_ClientInterface'
interface = env.File(name + '.i')
source = env.File(name + '.py')
if os.name == 'nt':
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX='_',
        SHLIBSUFFIX='.pyd')[:1]
else:
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX='_')
install_source = env.Install(lib_install_dir, source)
install_lib = env.Install(lib_install_dir, shlib)
install_test = env.Install(lib_install_dir, env.File('TestPythonSML.py'))
env.Alias(python_sml_alias, install_lib + install_source + install_test)

#!/usr/bin/python
# Project: Soar <http://soar.googlecode.com>
# Author: Jonathan Voigt <voigtjr@gmail.com>
#
import distutils.sysconfig as sysconfig
import os, os.path, sys
import SCons.Script
from ast import literal_eval
from subprocess import check_output

Import('env')
clone = env.Clone()
clone['SWIGPATH'] = clone['CPPPATH']
clone['SWIGFLAGS'] = ['-c++', '-python']
if GetOption('nosvs'):
    clone['SWIGFLAGS'].append('-DNO_SVS')
python_sml_alias = clone['SML_PYTHON_ALIAS']

python_exe = GetOption('python')
if os.name == 'nt':
    commands = ("distutils.sysconfig.get_python_inc()",
                "os.path.join(distutils.sysconfig.get_config_vars('BINDIR')[0], 'libs')",
                "'python' + distutils.sysconfig.get_config_vars('VERSION')[0]")
else:
    commands = ("distutils.sysconfig.get_python_inc()",
                "distutils.sysconfig.get_config_vars('LIBDIR')",
                "distutils.sysconfig.get_config_vars('LIBRARY')[0]")
command = """
import distutils.sysconfig;
import os.path;
print(tuple([{}]));
""".format(", ".join(commands))

lib_install_dir = clone['OUT_DIR']
inc_path, lib_path, pylib = literal_eval(check_output((python_exe, "-c", command)).decode())

if isinstance(lib_path, list):
    lib_path = lib_path[0]

clone.Append(CPPPATH = inc_path, LIBPATH = lib_path, LIBS = pylib)

if os.name == 'posix':
    clone.Append(CPPFLAGS = Split('-Wno-unused -fno-strict-aliasing'))

if sys.platform == 'darwin':
    clone.Replace(SHLINKFLAGS = Split('$LINKFLAGS -bundle -flat_namespace -undefined suppress'))
    clone.Replace(SHLIBSUFFIX = ['.so'])

name = 'Python_sml_ClientInterface'
interface = env.File(name + '.i')
source = env.File(name + '.py')

if os.name == 'nt':
    # the [:1] at the end throws away the .exp and .lib files that are generated
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX = '_', SHLIBSUFFIX = '.pyd')[:1]
else:
    shlib = clone.SharedLibrary(name, interface, SHLIBPREFIX = '_')
install_source = env.Install(lib_install_dir, source)
install_lib = env.Install(lib_install_dir, shlib)
install_test = env.Install(lib_install_dir, env.File('TestPythonSML.py'))

env.Alias(python_sml_alias, install_lib + install_source + install_test)
