#encoding: latin-1

# Aldrin
# Modular Sequencer
# Copyright (C) 2006 The Aldrin Development Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

Import('env','install')
import glob, os

#######################################
#
# aldrin extensions
#
#######################################

# this code basically just scans subdirectories for additional sconscript files
# and also provides a context for that sconscript to install an extension.

extension_dir_path = ""
extenv = None
extbasename = None

def install_extension(source):
	install('${ALDRIN_INSTALL_PATH}/extensions/' + extbasename, source)

for filename in os.listdir('.'):
	extension_dir_path = os.path.abspath(filename)
	if os.path.isfile(os.path.join(extension_dir_path,'SConscript')):
		extbasename = filename
		extenv = env.Copy()
		Export('extension_dir_path','extenv','install_extension')
		env.SConscript(os.path.join(extension_dir_path,'SConscript'))
