
##############################################################################
#
# 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
#
# Development 2012-2013 by School of Earth Sciences
# Development from 2014 by Centre for Geoscience Computing (GeoComp)
# Development from 2019 by School of Earth and Environmental Sciences
#
##############################################################################
import os

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

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

# compile
pyc = 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 = env.Install(Dir('escript', env['pyinstall']), pyc)
if env['sympy']:
    sym_py_inst = local_env.Install(os.path.join(local_env['pyinstall'],'escript','symbolic'), sym_pyc)
    env.Alias('install_escript', [ py_inst, sym_py_inst])
else:
    env.Alias('install_escript', [ py_inst ])
