#!/usr/bin/env python3

import os
import sys

Import('env')
package = 'library'
envlibrary = env.Clone()
envlibrary['PACKAGE'] = package
envlibrary['INSTALL_PATH'] = os.path.join(envlibrary['PRJ_SCONS_INSTALL'],package)
install = envlibrary['INSTALL_PATH']

# Patch to avoid build error conflicts with isceobj/Util/Library
old_cpppath = envlibrary['CPPPATH']
new_cpppath = []
for path in old_cpppath:
    if (path != os.path.join(envlibrary['PRJ_SCONS_BUILD'],'components','isceobj','Util','Library','include')):
        new_cpppath.append(path)
envlibrary['CPPPATH'] = new_cpppath

initFile = '__init__.py'
if not os.path.exists(initFile):
    fout = open(initFile,"w")
    fout.write("#!/usr/bin/env python3")
    fout.close()

listFiles = [initFile]
envlibrary.Install(install,listFiles)
envlibrary.Alias('install',install)
Export('envlibrary')
isceLib = 'isceLib/SConscript'
#roipacLib = 'roipacLib/SConscript'
#stdprocLib = 'stdprocLib/SConscript'
SConscript(isceLib)
#SConscript(roipacLib)
#SConscript(stdprocLib)
