-# -*- coding: utf-8 -*-\r
-\r
-############################################################################\r
-# GPL License #\r
-# #\r
-# This file is a SCons (http://www.scons.org/) builder #\r
-# Copyright (c) 2012-14, Philipp Kraus, <philipp.kraus@flashpixx.de> #\r
-# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved. #\r
-# This program is free software: you can redistribute it and/or modify #\r
-# it under the terms of the GNU General Public License as #\r
-# published by the Free Software Foundation, either version 3 of the #\r
-# License, or (at your option) any later version. #\r
-# #\r
-# This program is distributed in the hope that it will be useful, #\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of #\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #\r
-# GNU General Public License for more details. #\r
-# #\r
-# You should have received a copy of the GNU General Public License #\r
-# along with this program. If not, see <http://www.gnu.org/licenses/>. #\r
-############################################################################\r
-\r
-# This builder originated from work by Philipp Kraus and flashpixx project\r
-# (see https://github.com/flashpixx). Based on the Unpack.py, it only\r
-# contains changes to allow a complete unpacking of the archive.\r
-# It is assumed that the target represents a file in the archive after it\r
-# is unpacked.\r
-\r
-# The Unpack Builder can be used for unpacking archives (eg Zip, TGZ, BZ, ... ).\r
-# The emitter of the Builder reads the archive data and creates a returning\r
-# file list the builder extract the archive. The environment variable\r
-# stores a dictionary "UNPACK" for set different extractions (subdict "EXTRACTOR"):\r
-# {\r
-# PRIORITY => a value for setting the extractor order (lower numbers = extractor is used earlier)\r
-# SUFFIX => defines a list with file suffixes, which should be handled with this extractor\r
-# EXTRACTSUFFIX => suffix of the extract command\r
-# EXTRACTFLAGS => a string parameter for the RUN command for extracting the data\r
-# EXTRACTCMD => full extract command of the builder\r
-# RUN => the main program which will be started (if the parameter is empty, the extractor will be ignored)\r
-# LISTCMD => the listing command for the emitter\r
-# LISTFLAGS => the string options for the RUN command for showing a list of files\r
-# LISTSUFFIX => suffix of the list command\r
-# LISTEXTRACTOR => a optional Python function, that is called on each output line of the\r
-# LISTCMD for extracting file & dir names, the function need two parameters (first line number,\r
-# second line content) and must return a string with the file / dir path (other value types\r
-# will be ignored)\r
-# }\r
-# Other options in the UNPACK dictionary are:\r
-# STOPONEMPTYFILE => bool variable for stoping if the file has empty size (default True)\r
-# VIWEXTRACTOUTPUT => shows the output messages of the extraction command (default False)\r
-# EXTRACTDIR => path in that the data will be extracted (default #)\r
-#\r
-# The file which is handled by the first suffix match of the extractor, the extractor list can be append for other files.\r
-# The order of the extractor dictionary creates the listing & extractor command eg file extension .tar.gz should be\r
-# before .gz, because the tar.gz is extract in one shoot.\r
-#\r
-# Under *nix system these tools are supported: tar, bzip2, gzip, unzip\r
-# Under Windows only 7-Zip (http://www.7-zip.org/) is supported\r
-\r
-\r
-import subprocess, os\r
-import SCons.Errors, SCons.Warnings, SCons.Util\r
-\r
-# enables Scons warning for this builder\r
-class UnpackWarning(SCons.Warnings.Warning) :\r
- pass\r
-\r
-SCons.Warnings.enableWarningClass(UnpackWarning)\r
-\r
-# extractor function for Tar output\r
-# @param env environment object\r
-# @param count number of returning lines\r
-# @param no number of the output line\r
-# @param i line content\r
-def __fileextractor_nix_tar( env, count, no, i ) :\r
- return i.split()[-1]\r
-\r
-# extractor function for GZip output,\r
-# ignore the first line\r
-# @param env environment object\r
-# @param count number of returning lines\r
-# @param no number of the output line\r
-# @param i line content\r
-def __fileextractor_nix_gzip( env, count, no, i ) :\r
- if no == 0 :\r
- return None\r
- return i.split()[-1]\r
-\r
-# extractor function for Unzip output,\r
-# ignore the first & last two lines\r
-# @param env environment object\r
-# @param count number of returning lines\r
-# @param no number of the output line\r
-# @param i line content\r
-def __fileextractor_nix_unzip( env, count, no, i ) :\r
- if no < 3 or no >= count - 2 :\r
- return None\r
- return i.split()[-1]\r
-\r
-# extractor function for 7-Zip\r
-# @param env environment object\r
-# @param count number of returning lines\r
-# @param no number of the output line\r
-# @param i line content\r
-def __fileextractor_win_7zip( env, count, no, i ) :\r
- item = i.split()\r
- if no > 8 and no < count - 2 :\r
- return item[-1]\r
- return None\r
-\r
-\r
-\r
-# returns the extractor item for handling the source file\r
-# @param source input source file\r
-# @param env environment object\r
-# @return extractor entry or None on non existing\r
-def __getExtractor( source, env ) :\r
- # we check each unpacker and get the correct list command first, run the command and\r
- # replace the target filelist with the list values, we sorte the extractors by their priority\r
- for unpackername, extractor in sorted(env["UNPACK"]["EXTRACTOR"].iteritems(), key = lambda (k,v) : (v["PRIORITY"],k)):\r
-\r
- if not SCons.Util.is_String(extractor["RUN"]) :\r
- raise SCons.Errors.StopError("list command of the unpack builder for [%s] archives is not a string" % (unpackername))\r
- if not len(extractor["RUN"]) :\r
- raise SCons.Errors.StopError("run command of the unpack builder for [%s] archives is not set - can not extract files" % (unpackername))\r
-\r
-\r
- if not SCons.Util.is_String(extractor["LISTFLAGS"]) :\r
- raise SCons.Errors.StopError("list flags of the unpack builder for [%s] archives is not a string" % (unpackername))\r
- if not SCons.Util.is_String(extractor["LISTCMD"]) :\r
- raise SCons.Errors.StopError("list command of the unpack builder for [%s] archives is not a string" % (unpackername))\r
-\r
- if not SCons.Util.is_String(extractor["EXTRACTFLAGS"]) :\r
- raise SCons.Errors.StopError("extract flags of the unpack builder for [%s] archives is not a string" % (unpackername))\r
- if not SCons.Util.is_String(extractor["EXTRACTCMD"]) :\r
- raise SCons.Errors.StopError("extract command of the unpack builder for [%s] archives is not a string" % (unpackername))\r
-\r
-\r
- # check the source file suffix and if the first is found, run the list command\r
- if not SCons.Util.is_List(extractor["SUFFIX"]) :\r
- raise SCons.Errors.StopError("suffix list of the unpack builder for [%s] archives is not a list" % (unpackername))\r
-\r
- for suffix in extractor["SUFFIX"] :\r
- if str(source[0]).lower()[-len(suffix):] == suffix.lower() :\r
- return extractor\r
-\r
- return None\r
-\r
-\r
-# creates the extracter output message\r
-# @param s original message\r
-# @param target target name\r
-# @param source source name\r
-# @param env environment object\r
-def __message( s, target, source, env ) :\r
- print "extract [%s] ..." % (source[0])\r
-\r
-\r
-# action function for extracting of the data\r
-# @param target target packed file\r
-# @param source extracted files\r
-# @param env environment object\r
-def __action( target, source, env ) :\r
- extractor = __getExtractor(source, env)\r
- if not extractor :\r
- raise SCons.Errors.StopError( "can not find any extractor value for the source file [%s]" % (source[0]) )\r
-\r
- extractor_cmd = extractor["EXTRACTCMD"]\r
-\r
- # if the extract command is empty, we create an error\r
- if len(extractor_cmd) == 0 :\r
- raise SCons.Errors.StopError( "the extractor command for the source file [%s] is empty" % (source[0]) )\r
-\r
- # build it now (we need the shell, because some programs need it)\r
- handle = None\r
-\r
- source_path = os.path.realpath(source[0].path)\r
- target_path = os.path.realpath(target[0].path)\r
-\r
- cmd = env.subst(extractor_cmd, source=source_path, target=target)\r
- cwd = os.path.dirname(source_path)\r
-\r
- if env["UNPACK"]["VIWEXTRACTOUTPUT"] :\r
- handle = subprocess.Popen( cmd, shell=True )\r
- else :\r
- devnull = open(os.devnull, "wb")\r
- handle = subprocess.Popen( cmd, shell=True, stdout=devnull, cwd=cwd)\r
-\r
- if handle.wait() <> 0 :\r
- raise SCons.Errors.BuildError( "error running extractor [%s] on the source [%s]" % (cmd, source[0]) )\r
-\r
- fhandle = open(target_path, 'a')\r
- try:\r
- os.utime(target_path, None)\r
- finally:\r
- fhandle.close()\r
-\r
-\r
-# emitter function for getting the files\r
-# within the archive\r
-# @param target target packed file\r
-# @param source extracted files\r
-# @param env environment object\r
-def __emitter( target, source, env ) :\r
- return target, source\r
-\r
-\r
-# generate function, that adds the builder to the environment\r
-# @param env environment object\r
-def generate( env ) :\r
- # setup environment variable\r
- toolset = {\r
- "STOPONEMPTYFILE" : True,\r
- "VIWEXTRACTOUTPUT" : False,\r
- "EXTRACTDIR" : os.curdir,\r
- "EXTRACTOR" : {\r
- "TARGZ" : {\r
- "PRIORITY" : 0,\r
- "SUFFIX" : [".tar.gz", ".tgz", ".tar.gzip"],\r
- "EXTRACTSUFFIX" : "",\r
- "EXTRACTFLAGS" : "",\r
- "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['TARGZ']['RUN']} ${UNPACK['EXTRACTOR']['TARGZ']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARGZ']['EXTRACTSUFFIX']}",\r
- "RUN" : "",\r
- "LISTCMD" : "${UNPACK['EXTRACTOR']['TARGZ']['RUN']} ${UNPACK['EXTRACTOR']['TARGZ']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARGZ']['LISTSUFFIX']}",\r
- "LISTSUFFIX" : "",\r
- "LISTFLAGS" : "",\r
- "LISTEXTRACTOR" : None\r
- },\r
-\r
- "TARBZ" : {\r
- "PRIORITY" : 0,\r
- "SUFFIX" : [".tar.bz", ".tbz", ".tar.bz2", ".tar.bzip2", ".tar.bzip"],\r
- "EXTRACTSUFFIX" : "",\r
- "EXTRACTFLAGS" : "",\r
- "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['TARBZ']['RUN']} ${UNPACK['EXTRACTOR']['TARBZ']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARBZ']['EXTRACTSUFFIX']}",\r
- "RUN" : "",\r
- "LISTCMD" : "${UNPACK['EXTRACTOR']['TARBZ']['RUN']} ${UNPACK['EXTRACTOR']['TARBZ']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARBZ']['LISTSUFFIX']}",\r
- "LISTSUFFIX" : "",\r
- "LISTFLAGS" : "",\r
- "LISTEXTRACTOR" : None\r
- },\r
-\r
- "BZIP" : {\r
- "PRIORITY" : 1,\r
- "SUFFIX" : [".bz", "bzip", ".bz2", ".bzip2"],\r
- "EXTRACTSUFFIX" : "",\r
- "EXTRACTFLAGS" : "",\r
- "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['BZIP']['RUN']} ${UNPACK['EXTRACTOR']['BZIP']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['BZIP']['EXTRACTSUFFIX']}",\r
- "RUN" : "",\r
- "LISTCMD" : "${UNPACK['EXTRACTOR']['BZIP']['RUN']} ${UNPACK['EXTRACTOR']['BZIP']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['BZIP']['LISTSUFFIX']}",\r
- "LISTSUFFIX" : "",\r
- "LISTFLAGS" : "",\r
- "LISTEXTRACTOR" : None\r
- },\r
-\r
- "GZIP" : {\r
- "PRIORITY" : 1,\r
- "SUFFIX" : [".gz", ".gzip"],\r
- "EXTRACTSUFFIX" : "",\r
- "EXTRACTFLAGS" : "",\r
- "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['GZIP']['RUN']} ${UNPACK['EXTRACTOR']['GZIP']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['GZIP']['EXTRACTSUFFIX']}",\r
- "RUN" : "",\r
- "LISTCMD" : "${UNPACK['EXTRACTOR']['GZIP']['RUN']} ${UNPACK['EXTRACTOR']['GZIP']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['GZIP']['LISTSUFFIX']}",\r
- "LISTSUFFIX" : "",\r
- "LISTFLAGS" : "",\r
- "LISTEXTRACTOR" : None\r
- },\r
-\r
- "TAR" : {\r
- "PRIORITY" : 1,\r
- "SUFFIX" : [".tar"],\r
- "EXTRACTSUFFIX" : "",\r
- "EXTRACTFLAGS" : "",\r
- "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['TAR']['RUN']} ${UNPACK['EXTRACTOR']['TAR']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TAR']['EXTRACTSUFFIX']}",\r
- "RUN" : "",\r
- "LISTCMD" : "${UNPACK['EXTRACTOR']['TAR']['RUN']} ${UNPACK['EXTRACTOR']['TAR']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TAR']['LISTSUFFIX']}",\r
- "LISTSUFFIX" : "",\r
- "LISTFLAGS" : "",\r
- "LISTEXTRACTOR" : None\r
- },\r
-\r
- "ZIP" : {\r
- "PRIORITY" : 1,\r
- "SUFFIX" : [".zip"],\r
- "EXTRACTSUFFIX" : "",\r
- "EXTRACTFLAGS" : "",\r
- "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['ZIP']['RUN']} ${UNPACK['EXTRACTOR']['ZIP']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['ZIP']['EXTRACTSUFFIX']}",\r
- "RUN" : "",\r
- "LISTCMD" : "${UNPACK['EXTRACTOR']['ZIP']['RUN']} ${UNPACK['EXTRACTOR']['ZIP']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['ZIP']['LISTSUFFIX']}",\r
- "LISTSUFFIX" : "",\r
- "LISTFLAGS" : "",\r
- "LISTEXTRACTOR" : None\r
- }\r
- }\r
- }\r
-\r
- # read tools for Windows system\r
- if env["PLATFORM"] <> "darwin" and "win" in env["PLATFORM"] :\r
-\r
- if env.WhereIs("7z") :\r
- toolset["EXTRACTOR"]["TARGZ"]["RUN"] = "7z"\r
- toolset["EXTRACTOR"]["TARGZ"]["LISTEXTRACTOR"] = __fileextractor_win_7zip\r
- toolset["EXTRACTOR"]["TARGZ"]["LISTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["TARGZ"]["LISTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} l -sii -ttar -y -so"\r
- toolset["EXTRACTOR"]["TARGZ"]["EXTRACTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["TARGZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -oc:${UNPACK['EXTRACTDIR']}"\r
-\r
- toolset["EXTRACTOR"]["TARBZ"]["RUN"] = "7z"\r
- toolset["EXTRACTOR"]["TARBZ"]["LISTEXTRACTOR"] = __fileextractor_win_7zip\r
- toolset["EXTRACTOR"]["TARBZ"]["LISTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["TARBZ"]["LISTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} l -sii -ttar -y -so"\r
- toolset["EXTRACTOR"]["TARBZ"]["EXTRACTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["TARBZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -oc:${UNPACK['EXTRACTDIR']}"\r
-\r
- toolset["EXTRACTOR"]["BZIP"]["RUN"] = "7z"\r
- toolset["EXTRACTOR"]["BZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip\r
- toolset["EXTRACTOR"]["BZIP"]["LISTFLAGS"] = "l"\r
- toolset["EXTRACTOR"]["BZIP"]["LISTSUFFIX"] = "-y -so"\r
- toolset["EXTRACTOR"]["BZIP"]["EXTRACTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["BZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"\r
-\r
- toolset["EXTRACTOR"]["GZIP"]["RUN"] = "7z"\r
- toolset["EXTRACTOR"]["GZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip\r
- toolset["EXTRACTOR"]["GZIP"]["LISTFLAGS"] = "l"\r
- toolset["EXTRACTOR"]["GZIP"]["LISTSUFFIX"] = "-y -so"\r
- toolset["EXTRACTOR"]["GZIP"]["EXTRACTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["GZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"\r
-\r
- toolset["EXTRACTOR"]["ZIP"]["RUN"] = "7z"\r
- toolset["EXTRACTOR"]["ZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip\r
- toolset["EXTRACTOR"]["ZIP"]["LISTFLAGS"] = "l"\r
- toolset["EXTRACTOR"]["ZIP"]["LISTSUFFIX"] = "-y -so"\r
- toolset["EXTRACTOR"]["ZIP"]["EXTRACTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["ZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"\r
-\r
- toolset["EXTRACTOR"]["TAR"]["RUN"] = "7z"\r
- toolset["EXTRACTOR"]["TAR"]["LISTEXTRACTOR"] = __fileextractor_win_7zip\r
- toolset["EXTRACTOR"]["TAR"]["LISTFLAGS"] = "l"\r
- toolset["EXTRACTOR"]["TAR"]["LISTSUFFIX"] = "-y -ttar -so"\r
- toolset["EXTRACTOR"]["TAR"]["EXTRACTFLAGS"] = "x"\r
- toolset["EXTRACTOR"]["TAR"]["EXTRACTSUFFIX"] = "-y -ttar -oc:${UNPACK['EXTRACTDIR']}"\r
-\r
- # here can add some other Windows tools, that can handle the archive files\r
- # but I don't know which ones can handle all file types\r
-\r
-\r
-\r
- # read the tools on *nix systems and sets the default parameters\r
- elif env["PLATFORM"] in ["darwin", "linux", "posix"] :\r
-\r
- if env.WhereIs("unzip") :\r
- toolset["EXTRACTOR"]["ZIP"]["RUN"] = "unzip"\r
- toolset["EXTRACTOR"]["ZIP"]["LISTEXTRACTOR"] = __fileextractor_nix_unzip\r
- toolset["EXTRACTOR"]["ZIP"]["LISTFLAGS"] = "-l"\r
- toolset["EXTRACTOR"]["ZIP"]["EXTRACTFLAGS"] = "-oqq"\r
- toolset["EXTRACTOR"]["ZIP"]["EXTRACTSUFFIX"] = "-d ${UNPACK['EXTRACTDIR']}"\r
-\r
- if env.WhereIs("tar") :\r
- toolset["EXTRACTOR"]["TAR"]["RUN"] = "tar"\r
- toolset["EXTRACTOR"]["TAR"]["LISTEXTRACTOR"] = __fileextractor_nix_tar\r
- toolset["EXTRACTOR"]["TAR"]["LISTFLAGS"] = "tvf"\r
- toolset["EXTRACTOR"]["TAR"]["EXTRACTFLAGS"] = "xf"\r
- toolset["EXTRACTOR"]["TAR"]["EXTRACTSUFFIX"] = "-C ${UNPACK['EXTRACTDIR']}"\r
-\r
- toolset["EXTRACTOR"]["TARGZ"]["RUN"] = "tar"\r
- toolset["EXTRACTOR"]["TARGZ"]["LISTEXTRACTOR"] = __fileextractor_nix_tar\r
- toolset["EXTRACTOR"]["TARGZ"]["EXTRACTFLAGS"] = "xfz"\r
- toolset["EXTRACTOR"]["TARGZ"]["LISTFLAGS"] = "tvfz"\r
- toolset["EXTRACTOR"]["TARGZ"]["EXTRACTSUFFIX"] = "-C ${UNPACK['EXTRACTDIR']}"\r
-\r
- toolset["EXTRACTOR"]["TARBZ"]["RUN"] = "tar"\r
- toolset["EXTRACTOR"]["TARBZ"]["LISTEXTRACTOR"] = __fileextractor_nix_tar\r
- toolset["EXTRACTOR"]["TARBZ"]["EXTRACTFLAGS"] = "xfj"\r
- toolset["EXTRACTOR"]["TARBZ"]["LISTFLAGS"] = "tvfj"\r
- toolset["EXTRACTOR"]["TARBZ"]["EXTRACTSUFFIX"] = "-C ${UNPACK['EXTRACTDIR']}"\r
-\r
- if env.WhereIs("bzip2") :\r
- toolset["EXTRACTOR"]["BZIP"]["RUN"] = "bzip2"\r
- toolset["EXTRACTOR"]["BZIP"]["EXTRACTFLAGS"] = "-df"\r
-\r
- if env.WhereIs("gzip") :\r
- toolset["EXTRACTOR"]["GZIP"]["RUN"] = "gzip"\r
- toolset["EXTRACTOR"]["GZIP"]["LISTEXTRACTOR"] = __fileextractor_nix_gzip\r
- toolset["EXTRACTOR"]["GZIP"]["LISTFLAGS"] = "-l"\r
- toolset["EXTRACTOR"]["GZIP"]["EXTRACTFLAGS"] = "-df"\r
-\r
- else :\r
- raise SCons.Errors.StopError("Unpack tool detection on this platform [%s] unkown" % (env["PLATFORM"]))\r
-\r
- # the target_factory must be a "Entry", because the target list can be files and dirs, so we can not specified the targetfactory explicite\r
- env.Replace(UNPACK = toolset)\r
- env["BUILDERS"]["UnpackAll"] = SCons.Builder.Builder( action = __action, emitter = __emitter, target_factory = SCons.Node.FS.Entry, source_factory = SCons.Node.FS.File, single_source = True, PRINT_CMD_LINE_FUNC = __message )\r
-\r
-\r
-# existing function of the builder\r
-# @param env environment object\r
-# @return true\r
-def exists(env) :\r
- return 1\r
+# -*- coding: utf-8 -*-
+
+# -- Dual Licence ----------------------------------------------------------
+
+############################################################################
+# GPL License #
+# #
+# This file is a SCons (http://www.scons.org/) builder #
+# Copyright (c) 2012-14, Philipp Kraus, <philipp.kraus@flashpixx.de> #
+# 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 3 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, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# --------------------------------------------------------------------------
+
+############################################################################
+# BSD 3-Clause License #
+# #
+# This file is a SCons (http://www.scons.org/) builder #
+# Copyright (c) 2012-14, Philipp Kraus, <philipp.kraus@flashpixx.de> #
+# All rights reserved. #
+# #
+# Redistribution and use in source and binary forms, with or without #
+# modification, are permitted provided that the following conditions are #
+# met: #
+# #
+# 1. Redistributions of source code must retain the above copyright #
+# notice, this list of conditions and the following disclaimer. #
+# #
+# 2. Redistributions in binary form must reproduce the above copyright #
+# notice, this list of conditions and the following disclaimer in the #
+# documentation and/or other materials provided with the distribution. #
+# #
+# 3. Neither the name of the copyright holder nor the names of its #
+# contributors may be used to endorse or promote products derived from #
+# this software without specific prior written permission. #
+# #
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED #
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
+############################################################################
+
+
+
+# The Unpack Builder can be used for unpacking archives (eg Zip, TGZ, BZ, ... ).
+# The emitter of the Builder reads the archive data and creates a returning file list
+# the builder extract the archive. The environment variable stores a dictionary "UNPACK"
+# for set different extractions (subdict "EXTRACTOR"):
+# {
+# PRIORITY => a value for setting the extractor order (lower numbers = extractor is used earlier)
+# SUFFIX => defines a list with file suffixes, which should be handled with this extractor
+# EXTRACTSUFFIX => suffix of the extract command
+# EXTRACTFLAGS => a string parameter for the RUN command for extracting the data
+# EXTRACTCMD => full extract command of the builder
+# RUN => the main program which will be started (if the parameter is empty, the extractor will be ignored)
+# LISTCMD => the listing command for the emitter
+# LISTFLAGS => the string options for the RUN command for showing a list of files
+# LISTSUFFIX => suffix of the list command
+# LISTEXTRACTOR => a optional Python function, that is called on each output line of the
+# LISTCMD for extracting file & dir names, the function need two parameters (first line number,
+# second line content) and must return a string with the file / dir path (other value types
+# will be ignored)
+# }
+# Other options in the UNPACK dictionary are:
+# STOPONEMPTYFILE => bool variable for stoping if the file has empty size (default True)
+# VIWEXTRACTOUTPUT => shows the output messages of the extraction command (default False)
+# EXTRACTDIR => path in that the data will be extracted (default #)
+#
+# The file which is handled by the first suffix match of the extractor, the extractor list can be append for other files.
+# The order of the extractor dictionary creates the listing & extractor command eg file extension .tar.gz should be
+# before .gz, because the tar.gz is extract in one shoot.
+#
+# Under *nix system these tools are supported: tar, bzip2, gzip, unzip
+# Under Windows only 7-Zip (http://www.7-zip.org/) is supported
+
+
+import subprocess, os
+
+import SCons.Errors, SCons.Warnings
+import SCons.Util
+
+
+# enables Scons warning for this builder
+class UnpackWarning(SCons.Warnings.Warning) :
+ pass
+
+SCons.Warnings.enableWarningClass(UnpackWarning)
+
+
+
+# extractor function for Tar output
+# @param env environment object
+# @param count number of returning lines
+# @param no number of the output line
+# @param i line content
+def __fileextractor_nix_tar( env, count, no, i ) :
+ return i.split()[-1]
+
+# extractor function for GZip output,
+# ignore the first line
+# @param env environment object
+# @param count number of returning lines
+# @param no number of the output line
+# @param i line content
+def __fileextractor_nix_gzip( env, count, no, i ) :
+ if no == 0 :
+ return None
+ return i.split()[-1]
+
+# extractor function for Unzip output,
+# ignore the first & last two lines
+# @param env environment object
+# @param count number of returning lines
+# @param no number of the output line
+# @param i line content
+def __fileextractor_nix_unzip( env, count, no, i ) :
+ if no < 3 or no >= count - 2 :
+ return None
+ return i.split()[-1]
+
+# extractor function for 7-Zip
+# @param env environment object
+# @param count number of returning lines
+# @param no number of the output line
+# @param i line content
+def __fileextractor_win_7zip( env, count, no, i ) :
+ item = i.split()
+ if no > 8 and no < count - 2 :
+ return item[-1]
+ return None
+
+
+
+# returns the extractor item for handling the source file
+# @param source input source file
+# @param env environment object
+# @return extractor entry or None on non existing
+def __getExtractor( source, env ) :
+ # we check each unpacker and get the correc list command first, run the command and
+ # replace the target filelist with the list values, we sorte the extractors by their priority
+ for unpackername, extractor in sorted(env["UNPACK"]["EXTRACTOR"].iteritems(), key = lambda (k,v) : (v["PRIORITY"],k)):
+
+ # if the run command not set, we continue the extractor search, otherwise we check the extractor parameters
+ if not SCons.Util.is_String(extractor["RUN"]) :
+ raise SCons.Errors.StopError("list command of the unpack builder for [%s] archives is not a string" % (unpackername))
+ if not len(extractor["RUN"]) :
+ raise SCons.Errors.StopError("run command of the unpack builder for [%s] archives is not set - can not extract files" % (unpackername))
+
+
+ if not SCons.Util.is_String(extractor["LISTFLAGS"]) :
+ raise SCons.Errors.StopError("list flags of the unpack builder for [%s] archives is not a string" % (unpackername))
+ if not SCons.Util.is_String(extractor["LISTCMD"]) :
+ raise SCons.Errors.StopError("list command of the unpack builder for [%s] archives is not a string" % (unpackername))
+
+ if not SCons.Util.is_String(extractor["EXTRACTFLAGS"]) :
+ raise SCons.Errors.StopError("extract flags of the unpack builder for [%s] archives is not a string" % (unpackername))
+ if not SCons.Util.is_String(extractor["EXTRACTCMD"]) :
+ raise SCons.Errors.StopError("extract command of the unpack builder for [%s] archives is not a string" % (unpackername))
+
+
+ # check the source file suffix and if the first is found, run the list command
+ if not SCons.Util.is_List(extractor["SUFFIX"]) :
+ raise SCons.Errors.StopError("suffix list of the unpack builder for [%s] archives is not a list" % (unpackername))
+
+ for suffix in extractor["SUFFIX"] :
+ if str(source[0]).lower()[-len(suffix):] == suffix.lower() :
+ return extractor
+
+ return None
+
+
+# creates the extracter output message
+# @param s original message
+# @param target target name
+# @param source source name
+# @param env environment object
+def __message( s, target, source, env ) :
+ print "extract [%s] ..." % (source[0])
+
+
+# action function for extracting of the data
+# @param target target packed file
+# @param source extracted files
+# @env environment object
+def __action( target, source, env ) :
+ extractor = __getExtractor(source, env)
+ if not extractor :
+ raise SCons.Errors.StopError( "can not find any extractor value for the source file [%s]" % (source[0]) )
+
+
+ # if the extract command is empty, we create an error
+ if len(extractor["EXTRACTCMD"]) == 0 :
+ raise SCons.Errors.StopError( "the extractor command for the source file [%s] is empty" % (source[0]) )
+
+ # build it now (we need the shell, because some programs need it)
+ handle = None
+
+ source_path = os.path.realpath(source[0].path)
+ target_path = os.path.realpath(target[0].path)
+
+ cmd = env.subst(extractor["EXTRACTCMD"], source=source_path, target=target)
+ cwd = os.path.dirname(source_path)
+
+ if env["UNPACK"]["VIWEXTRACTOUTPUT"] :
+ handle = subprocess.Popen( cmd, shell=True )
+ else :
+ devnull = open(os.devnull, "wb")
+ handle = subprocess.Popen( cmd, shell=True, stdout=devnull, cwd=cwd)
+
+ if handle.wait() <> 0 :
+ raise SCons.Errors.BuildError( "error running extractor [%s] on the source [%s]" % (cmd, source[0]) )
+
+ fhandle = open(target_path, 'a')
+ try:
+ os.utime(target_path, None)
+ finally:
+ fhandle.close()
+
+
+# emitter function for getting the files
+# within the archive
+# @param target target packed file
+# @param source extracted files
+# @env environment object
+def __emitter( target, source, env ) :
+ return target, source
+
+
+
+
+# generate function, that adds the builder to the environment
+# @env environment object
+def generate( env ) :
+ # setup environment variable
+ toolset = {
+ "STOPONEMPTYFILE" : True,
+ "VIWEXTRACTOUTPUT" : False,
+ "EXTRACTDIR" : os.curdir,
+ "EXTRACTOR" : {
+ "TARGZ" : {
+ "PRIORITY" : 0,
+ "SUFFIX" : [".tar.gz", ".tgz", ".tar.gzip"],
+ "EXTRACTSUFFIX" : "",
+ "EXTRACTFLAGS" : "",
+ "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['TARGZ']['RUN']} ${UNPACK['EXTRACTOR']['TARGZ']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARGZ']['EXTRACTSUFFIX']}",
+ "RUN" : "",
+ "LISTCMD" : "${UNPACK['EXTRACTOR']['TARGZ']['RUN']} ${UNPACK['EXTRACTOR']['TARGZ']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARGZ']['LISTSUFFIX']}",
+ "LISTSUFFIX" : "",
+ "LISTFLAGS" : "",
+ "LISTEXTRACTOR" : None
+ },
+
+ "TARBZ" : {
+ "PRIORITY" : 0,
+ "SUFFIX" : [".tar.bz", ".tbz", ".tar.bz2", ".tar.bzip2", ".tar.bzip"],
+ "EXTRACTSUFFIX" : "",
+ "EXTRACTFLAGS" : "",
+ "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['TARBZ']['RUN']} ${UNPACK['EXTRACTOR']['TARBZ']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARBZ']['EXTRACTSUFFIX']}",
+ "RUN" : "",
+ "LISTCMD" : "${UNPACK['EXTRACTOR']['TARBZ']['RUN']} ${UNPACK['EXTRACTOR']['TARBZ']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TARBZ']['LISTSUFFIX']}",
+ "LISTSUFFIX" : "",
+ "LISTFLAGS" : "",
+ "LISTEXTRACTOR" : None
+ },
+
+ "BZIP" : {
+ "PRIORITY" : 1,
+ "SUFFIX" : [".bz", "bzip", ".bz2", ".bzip2"],
+ "EXTRACTSUFFIX" : "",
+ "EXTRACTFLAGS" : "",
+ "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['BZIP']['RUN']} ${UNPACK['EXTRACTOR']['BZIP']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['BZIP']['EXTRACTSUFFIX']}",
+ "RUN" : "",
+ "LISTCMD" : "${UNPACK['EXTRACTOR']['BZIP']['RUN']} ${UNPACK['EXTRACTOR']['BZIP']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['BZIP']['LISTSUFFIX']}",
+ "LISTSUFFIX" : "",
+ "LISTFLAGS" : "",
+ "LISTEXTRACTOR" : None
+ },
+
+ "GZIP" : {
+ "PRIORITY" : 1,
+ "SUFFIX" : [".gz", ".gzip"],
+ "EXTRACTSUFFIX" : "",
+ "EXTRACTFLAGS" : "",
+ "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['GZIP']['RUN']} ${UNPACK['EXTRACTOR']['GZIP']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['GZIP']['EXTRACTSUFFIX']}",
+ "RUN" : "",
+ "LISTCMD" : "${UNPACK['EXTRACTOR']['GZIP']['RUN']} ${UNPACK['EXTRACTOR']['GZIP']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['GZIP']['LISTSUFFIX']}",
+ "LISTSUFFIX" : "",
+ "LISTFLAGS" : "",
+ "LISTEXTRACTOR" : None
+ },
+
+ "TAR" : {
+ "PRIORITY" : 1,
+ "SUFFIX" : [".tar"],
+ "EXTRACTSUFFIX" : "",
+ "EXTRACTFLAGS" : "",
+ "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['TAR']['RUN']} ${UNPACK['EXTRACTOR']['TAR']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TAR']['EXTRACTSUFFIX']}",
+ "RUN" : "",
+ "LISTCMD" : "${UNPACK['EXTRACTOR']['TAR']['RUN']} ${UNPACK['EXTRACTOR']['TAR']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['TAR']['LISTSUFFIX']}",
+ "LISTSUFFIX" : "",
+ "LISTFLAGS" : "",
+ "LISTEXTRACTOR" : None
+ },
+
+ "ZIP" : {
+ "PRIORITY" : 1,
+ "SUFFIX" : [".zip"],
+ "EXTRACTSUFFIX" : "",
+ "EXTRACTFLAGS" : "",
+ "EXTRACTCMD" : "${UNPACK['EXTRACTOR']['ZIP']['RUN']} ${UNPACK['EXTRACTOR']['ZIP']['EXTRACTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['ZIP']['EXTRACTSUFFIX']}",
+ "RUN" : "",
+ "LISTCMD" : "${UNPACK['EXTRACTOR']['ZIP']['RUN']} ${UNPACK['EXTRACTOR']['ZIP']['LISTFLAGS']} $SOURCE ${UNPACK['EXTRACTOR']['ZIP']['LISTSUFFIX']}",
+ "LISTSUFFIX" : "",
+ "LISTFLAGS" : "",
+ "LISTEXTRACTOR" : None
+ }
+ }
+ }
+
+ # read tools for Windows system
+ if env["PLATFORM"] <> "darwin" and "win" in env["PLATFORM"] :
+
+ if env.WhereIs("7z"):
+ toolset["EXTRACTOR"]["TARGZ"]["RUN"] = "7z"
+ toolset["EXTRACTOR"]["TARGZ"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
+ toolset["EXTRACTOR"]["TARGZ"]["LISTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["TARGZ"]["LISTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} l -sii -ttar -y -so"
+ toolset["EXTRACTOR"]["TARGZ"]["EXTRACTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["TARGZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -oc:${UNPACK['EXTRACTDIR']}"
+
+ toolset["EXTRACTOR"]["TARBZ"]["RUN"] = "7z"
+ toolset["EXTRACTOR"]["TARBZ"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
+ toolset["EXTRACTOR"]["TARBZ"]["LISTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["TARBZ"]["LISTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} l -sii -ttar -y -so"
+ toolset["EXTRACTOR"]["TARBZ"]["EXTRACTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["TARBZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -oc:${UNPACK['EXTRACTDIR']}"
+
+ toolset["EXTRACTOR"]["BZIP"]["RUN"] = "7z"
+ toolset["EXTRACTOR"]["BZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
+ toolset["EXTRACTOR"]["BZIP"]["LISTFLAGS"] = "l"
+ toolset["EXTRACTOR"]["BZIP"]["LISTSUFFIX"] = "-y -so"
+ toolset["EXTRACTOR"]["BZIP"]["EXTRACTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["BZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"
+
+ toolset["EXTRACTOR"]["GZIP"]["RUN"] = "7z"
+ toolset["EXTRACTOR"]["GZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
+ toolset["EXTRACTOR"]["GZIP"]["LISTFLAGS"] = "l"
+ toolset["EXTRACTOR"]["GZIP"]["LISTSUFFIX"] = "-y -so"
+ toolset["EXTRACTOR"]["GZIP"]["EXTRACTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["GZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"
+
+ toolset["EXTRACTOR"]["ZIP"]["RUN"] = "7z"
+ toolset["EXTRACTOR"]["ZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
+ toolset["EXTRACTOR"]["ZIP"]["LISTFLAGS"] = "l"
+ toolset["EXTRACTOR"]["ZIP"]["LISTSUFFIX"] = "-y -so"
+ toolset["EXTRACTOR"]["ZIP"]["EXTRACTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["ZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"
+
+ toolset["EXTRACTOR"]["TAR"]["RUN"] = "7z"
+ toolset["EXTRACTOR"]["TAR"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
+ toolset["EXTRACTOR"]["TAR"]["LISTFLAGS"] = "l"
+ toolset["EXTRACTOR"]["TAR"]["LISTSUFFIX"] = "-y -ttar -so"
+ toolset["EXTRACTOR"]["TAR"]["EXTRACTFLAGS"] = "x"
+ toolset["EXTRACTOR"]["TAR"]["EXTRACTSUFFIX"] = "-y -ttar -oc:${UNPACK['EXTRACTDIR']}"
+
+ # here can add some other Windows tools, that can handle the archive files
+ # but I don't know which ones can handle all file types
+
+
+
+ # read the tools on *nix systems and sets the default parameters
+ elif env["PLATFORM"] in ["darwin", "linux", "posix", "msys"] :
+
+ if env.WhereIs("unzip") :
+ toolset["EXTRACTOR"]["ZIP"]["RUN"] = "unzip"
+ toolset["EXTRACTOR"]["ZIP"]["LISTEXTRACTOR"] = __fileextractor_nix_unzip
+ toolset["EXTRACTOR"]["ZIP"]["LISTFLAGS"] = "-l"
+ toolset["EXTRACTOR"]["ZIP"]["EXTRACTFLAGS"] = "-oqq"
+ toolset["EXTRACTOR"]["ZIP"]["EXTRACTSUFFIX"] = "-d ${UNPACK['EXTRACTDIR']}"
+
+ if env.WhereIs("tar") :
+ toolset["EXTRACTOR"]["TAR"]["RUN"] = "tar"
+ toolset["EXTRACTOR"]["TAR"]["LISTEXTRACTOR"] = __fileextractor_nix_tar
+ toolset["EXTRACTOR"]["TAR"]["LISTFLAGS"] = "tvf"
+ toolset["EXTRACTOR"]["TAR"]["EXTRACTFLAGS"] = "xf"
+ toolset["EXTRACTOR"]["TAR"]["EXTRACTSUFFIX"] = "-C ${UNPACK['EXTRACTDIR']}"
+
+ toolset["EXTRACTOR"]["TARGZ"]["RUN"] = "tar"
+ toolset["EXTRACTOR"]["TARGZ"]["LISTEXTRACTOR"] = __fileextractor_nix_tar
+ toolset["EXTRACTOR"]["TARGZ"]["EXTRACTFLAGS"] = "xfz"
+ toolset["EXTRACTOR"]["TARGZ"]["LISTFLAGS"] = "tvfz"
+ toolset["EXTRACTOR"]["TARGZ"]["EXTRACTSUFFIX"] = "-C ${UNPACK['EXTRACTDIR']}"
+
+ toolset["EXTRACTOR"]["TARBZ"]["RUN"] = "tar"
+ toolset["EXTRACTOR"]["TARBZ"]["LISTEXTRACTOR"] = __fileextractor_nix_tar
+ toolset["EXTRACTOR"]["TARBZ"]["EXTRACTFLAGS"] = "xfj"
+ toolset["EXTRACTOR"]["TARBZ"]["LISTFLAGS"] = "tvfj"
+ toolset["EXTRACTOR"]["TARBZ"]["EXTRACTSUFFIX"] = "-C ${UNPACK['EXTRACTDIR']}"
+
+ if env.WhereIs("bzip2") :
+ toolset["EXTRACTOR"]["BZIP"]["RUN"] = "bzip2"
+ toolset["EXTRACTOR"]["BZIP"]["EXTRACTFLAGS"] = "-df"
+
+ if env.WhereIs("gzip") :
+ toolset["EXTRACTOR"]["GZIP"]["RUN"] = "gzip"
+ toolset["EXTRACTOR"]["GZIP"]["LISTEXTRACTOR"] = __fileextractor_nix_gzip
+ toolset["EXTRACTOR"]["GZIP"]["LISTFLAGS"] = "-l"
+ toolset["EXTRACTOR"]["GZIP"]["EXTRACTFLAGS"] = "-df"
+
+ else :
+ raise SCons.Errors.StopError("Unpack tool detection on this platform [%s] unkown" % (env["PLATFORM"]))
+
+ # the target_factory must be a "Entry", because the target list can be files and dirs, so we can not specified the targetfactory explicite
+ env.Replace(UNPACK = toolset)
+ env["BUILDERS"]["UnpackAll"] = SCons.Builder.Builder( action = __action, emitter = __emitter, target_factory = SCons.Node.FS.Entry, source_factory = SCons.Node.FS.File, single_source = True, PRINT_CMD_LINE_FUNC = __message )
+
+
+# existing function of the builder
+# @param env environment object
+# @return true
+def exists(env) :
+ return 1
\ No newline at end of file