
##############################################################################
#
# Copyright (c) 2003-2026 by the esys.escript Group
# https://github.com/LutzGross/esys-escript.github.io
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# See CREDITS file for contributors and development history
#
##############################################################################

import os
Import('*')
local_env = env.Clone()

# get the source file names
sources = Glob('*.py')
if env['sympy']:
	sym_sources = Glob(os.path.join('symboliccore','*.py'))

# compile
pyc = local_env.PyCompile(sources)
if env['sympy']:
	sym_pyc = local_env.PyCompile(sym_sources)
	env.Alias('build_escript', [pyc, sym_pyc])
else:
	env.Alias('build_escript', [ pyc ])

# install
py_inst = local_env.Install(Dir('escriptcore', local_env['pyinstall']), pyc)
if env['sympy']:
	sym_py_inst = local_env.Install(os.path.join(local_env['pyinstall'],'escriptcore','symboliccore'), sym_pyc)
	env.Alias('install_escript', [ py_inst, sym_py_inst])
else:
	env.Alias('install_escript', [ py_inst ])
