��
r�$Lc�����������@���s����d��Z��d�Z�d�d�k�Z�d�d�k�Z�d�d�k�Z�d�e�f�d�������YZ�e�Z�d����Z	�d�e�f�d�������YZ
�d	�e�f�d
�������YZ�d�e�f�d�������YZ�d
�e�f�d�������YZ
�d�e
�f�d�������YZ�d�e�f�d�������YZ�d�S(���sQ���SCons.Scanner

The Scanner package for the SCons software construction utility.

sC���src/engine/SCons/Scanner/__init__.py 5023 2010/06/14 22:05:46 sconsi����Nt���_Nullc�����������B���s���e��Z�RS(����(���t���__name__t
���__module__(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR����&���s���c���������O���s8���t��i�i�|����o�t�|��|�|���St�|��|�|���Sd�S(���s���
    Public interface factory function for creating different types
    of Scanners based on the different types of "functions" that may
    be supplied.

    TODO:  Deprecate this some day.  We've moved the functionality
    inside the Base class and really don't need this factory function
    any more.  It was, however, used by some of our Tool modules, so
    the call probably ended up in various people's custom modules
    patterned on SCons code.
    N(���t���SConst���Utilt���is_Dictt���Selectort���Base(���t���functiont���argst���kw(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���Scanner-���s����t���FindPathDirsc�����������B���s,���e��Z�d��Z�d����Z�d�d�d�d�d���Z�RS(���so���A class to bind a specific *PATH variable name to a function that
    will return all of the *path directories.c���������C���s
���|�|��_��d��S(���N(���t���variable(���t���selfR
���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���__init__C���s����c���������C���s{���d�d��k��}�y�|�|��i�}�Wn�t�j
�o�d�SX|�p
�|�i�i�}�|�i�i�|���i�|�|�|���}�t�|�i�|�����S(���Ni����(����(	���t���SCons.PathListR
���t���KeyErrort���fst���_cwdt���PathListt
���subst_patht���tuplet���Rfindalldirs(���R���t���envt���dirt���targett���sourcet���argumentR���t���path(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���__call__E���s����!N(���R���R���t���__doc__R���t���NoneR���(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR���@���s���	R���c��������	���B���s����e��Z�d��Z�d�e�e�d�e�i�i�i�d�d�d�d���Z	�d�d�d�d���Z
�d�d���Z�d����Z�d����Z
�d����Z�d����Z�d�d	���Z�d
����Z�d����Z�d����Z�e�Z�d
����Z�RS(���s~���
    The base class for dependency scanners.  This implements
    straightforward, single-pass scanning of a single file.
    t���NONEc
���
������C���s����|�|��_��|�|��_�|�|��_�|�|��_�|�t�j�o3�t�i�i�|���o�t�|�i	������}�qd�g��}�n�|�|��_
�|�|��_�|�|��_�|�|��_
�t�|	���o
�|	�|��_�n$�|	�o�|��i�|��_�n
�|��i�|��_�d�S(���s�
��
        Construct a new scanner object given a scanner function.

        'function' - a scanner function taking two or three
        arguments and returning a list of strings.

        'name' - a name for identifying this scanner object.

        'argument' - an optional argument that, if specified, will be
        passed to both the scanner function and the path_function.

        'skeys' - an optional list argument that can be used to determine
        which scanner should be used for a given Node. In the case of File
        nodes, for example, the 'skeys' would be file suffixes.

        'path_function' - a function that takes four or five arguments
        (a construction environment, Node for the directory containing
        the SConscript file that defined the primary target, list of
        target nodes, list of source nodes, and optional argument for
        this instance) and returns a tuple of the directories that can
        be searched for implicit dependency files.  May also return a
        callable() which is called with no args and returns the tuple
        (supporting Bindable class).

        'node_class' - the class of Nodes which this scan will return.
        If node_class is None, then this scanner will not enforce any
        Node conversion and will return the raw results from the
        underlying scanner function.

        'node_factory' - the factory function to be called to translate
        the raw results returned by the scanner function into the
        expected node_class objects.

        'scan_check' - a function to be called to first check whether
        this node really needs to be scanned.

        'recursive' - specifies that this scanner should be invoked
        recursively on all of the implicit dependencies it returns
        (the canonical example being #include lines in C source files).
        May be a callable, which will be called to filter the list
        of nodes found to select a subset for recursive scanning
        (the canonical example being only recursively scanning
        subdirectories within a directory).

        The scanner function's first argument will be a Node that should
        be scanned for dependencies, the second argument will be an
        Environment object, the third argument will be the tuple of paths
        returned by the path_function, and the fourth argument will be
        the value passed into 'argument', and the returned list should
        contain the Nodes for all the direct dependencies of the file.

        Examples:

        s = Scanner(my_scanner_function)

        s = Scanner(function = my_scanner_function)

        s = Scanner(function = my_scanner_function, argument = 'foo')

        N(���R���t
���path_functiont���nameR���t���_nullR���R���R���t���listt���keyst���skeyst
���node_classt���node_factoryt
���scan_checkt���callablet
���recurse_nodest���_recurse_all_nodest���_recurse_no_nodes(
���R���R���R#���R���R'���R"���R(���R)���R*���t	���recursive(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR���X���s"����N				

				

c���������C���sV���|��i��p�d�S|��i�t�j	�o�|��i��|�|�|�|�|��i���S|��i��|�|�|�|���Sd��S(���N(����(���R"���R���R$���(���R���R���R���R���R���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR�������s
����
c���	������C���s��|��i��o�|��i��|�|���o�g��S|��i�|���}��|��i�t�j	�o�|��i�|�|�|�|��i���}�n�|��i�|�|�|���}�h��}�t�|�d���o�|�i�|�d�<n�|�i�|��i���}�g��}�xL�|�D]D�}�|��i	�o'�t
�|�|��i	���o�|�|�|���}�n�|�i�|���q��W|�S(���s!��
        This method scans a single object. 'node' is the node
        that will be passed to the scanner function, and 'env' is the
        environment that will be passed to the scanner function. A list of
        direct dependency nodes for the specified node will be returned.
        R���t	���directory(���R*���t���selectR���R$���R���t���hasattrR���t���get_factoryR)���R(���t
���isinstancet���append(	���R���t���nodeR���R���R%���R
���R)���t���nodest���l(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR�������s"�����c���������C���s>���y�t��|��i�|�i���SWn �t�j
�o�t��|��i�|���SXd��S(���N(���t���cmpt���__dict__t���AttributeError(���R���t���other(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���__cmp__����s����c���������C���s
���t��|����S(���N(���t���id(���R���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���__hash__����s����c���������C���s���|��i��S(���N(���R#���(���R���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���__str__����s����c���������C���s���|��i��i�|���d�S(���s���Add a skey to the list of skeysN(���R'���R5���(���R���t���skey(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���add_skey����s����c���������C���s9���|�o+�t��i�i�|��i���o�|�i�|��i���d�S|��i�S(���Ni����(���R���R���t	���is_StringR'���t
���subst_list(���R���R���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt	���get_skeys����s����c���������C���sT���t��i�i�|��i���o6�|�i����}�y�|��i�|�SWqP�t�j
�o�d��SXn�|��Sd��S(���N(���R���R���R���R���t���scanner_keyR���R ���(���R���R6���t���key(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR1�������s����
c���������C���s���|�S(���N(����(���R���R7���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR-������s����c���������C���s���g��S(���N(����(���R���R7���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR.�����s����c���������C���s���|�|��i��|�<|��i�|���d��S(���N(���R���RB���(���R���RA���t���scanner(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���add_scanner��s����
N(����(���R���R���R���R$���R ���R���t���Nodet���FSR���R���R���R���R=���R?���R@���RB���RE���R1���R-���R.���R,���RI���(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR���R���s*���Y					
		R���c�����������B���s5���e��Z�d��Z�d����Z�d�d���Z�d����Z�d����Z�RS(���s���
    A class for selecting a more specific scanner based on the
    scanner_key() (suffix) for a specific Node.

    TODO:  This functionality has been moved into the inner workings of
    the Base class, and this class will be deprecated at some point.
    (It was never exposed directly as part of the public interface,
    although it is used by the Scanner() factory function that was
    used by various Tool modules and therefore was likely a template
    for custom modules that may be out there.)
    c���������O���s8���t��i�|��d��|�|���|�|��_�t�|�i������|��_�d��S(���N(���R���R���R ���t���dictR%���R&���R'���(���R���RL���R	���R
���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR�����s����	c���������C���s���|��i��|���|�|�|���S(���N(���R1���(���R���R6���R���R���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR�����s����c���������C���s0���y�|��i��|�i����SWn�t�j
�o�d��SXd��S(���N(���RL���RF���R���R ���(���R���R6���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR1���!��s����c���������C���s���|�|��i��|�<|��i�|���d��S(���N(���RL���RB���(���R���RA���RH���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyRI���'��s����
(����(���R���R���R���R���R���R1���RI���(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR���
��s
���		t���Currentc�����������B���s���e��Z�d��Z�d����Z�RS(���s����
    A class for scanning files that are source files (have no builder)
    or are derived files and are current (which implies that they exist,
    either locally or in a repository).
    c���������O���s*���d����}�|�|�d�<t��i�|��|�|���d��S(���Nc���������S���s���|��i�����p
�|��i����S(���N(���t���has_buildert
���is_up_to_date(���R6���R���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt
���current_check4��s����R*���(���R���R���(���R���R	���R
���RP���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR���3��s����	
(���R���R���R���R���(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyRM���,��s���t���Classicc�����������B���s>���e��Z�d��Z�d����Z�d����Z�d����Z�d����Z�d�d���Z�RS(���s���
    A Scanner subclass to contain the common logic for classic CPP-style
    include scanning, but which can be customized to use different
    regular expressions to find the includes.

    Note that in order for this to work "out of the box" (without
    overriding the find_include() and sort_key() methods), the regular
    expression passed to the constructor must return the name of the
    include file in group 0.
    c���������O���sv���t��i�|�t��i���|��_�d�|��d���}�|�|�d�<t�|���|�d�<d�|�d�<|�|�d�<|�|�d�<t�i�|��|�|���d��S(	���Nc���������S���s.���|��i�����}��|��i����p�g��S|�i�|��|���S(���N(���t���rfilet���existst���scan(���R6���R���R���R���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���_scanI��s����
R���R"���i���R/���R'���R#���(����(���t���ret���compilet���Mt���creR���RM���R���(���R���R#���t���suffixest
���path_variablet���regexR	���R
���RU���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyR���E��s����



c���������C���s/���t��i�i�i�|�|�f�t�|�����}�|�|�f�S(���N(���R���RJ���RK���t	���find_fileR���(���R���t���includet
���source_dirR���t���n(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���find_includeW��s����%c���������C���s���t��i�i�i�|���S(���N(���R���RJ���RK���t���_my_normcase(���R���R^���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���sort_key[��s����c���������C���s���|��i��i�|�i������S(���N(���RY���t���findallt���get_text_contents(���R���R6���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���find_include_names^��s����c���������C���s��|�i��d��j	�o
�|�i��}�n.�|��i�|���}�t�t�t�i�i�|�����|�_��g��}�|�i����}�t	�|���o
�|����}�n�xy�|�D]q�}�|��i
�|�|�|���\�}�}�|�d��j�o'�t�i�i�t�i�i
�d�|�|�f���q}�|�i�|��i�|���|�f���q}�Wg��}	�t�|���D]�}
�|	�|
�d�q~	�S(���NsJ���No dependency generated for file: %s (included from: %s) -- file not foundi���(���t���includesR ���Rf���R%���t���mapR���R���t
���silent_internt���get_dirR+���Ra���t���Warningst���warnt���DependencyWarningR5���Rc���t���sorted(���R���R6���R���Rg���R7���R_���R^���R`���t���it���_[1]t���pair(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyRT���a��s ����


�
 (����(���R���R���R���R���Ra���Rc���Rf���RT���(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyRQ���9��s���
				t
���ClassicCPPc�����������B���s ���e��Z�d��Z�d����Z�d����Z�RS(���s|��
    A Classic Scanner subclass which takes into account the type of
    bracketing used to include the file, and uses classic CPP rules
    for searching for the files based on the bracketing.

    Note that in order for this to work, the regular expression passed
    to the constructor must return the leading bracket in group 0, and
    the contained filename in group 1.
    c���������C���sw���|�d�d�j�o�|�f�t��|���}�n�t��|���|�f�}�t�i�i�i�|�d�|���}�t�i�i�|�d���}�|�|�f�S(���Ni����t���"i���(���R���R���RJ���RK���R]���R���Ri���(���R���R^���R_���R���t���pathsR`���Ro���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyRa������s����c���������C���s���t��i�i�i�d�i�|�����S(���Nt��� (���R���RJ���RK���Rb���t���join(���R���R^���(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyRc������s����(���R���R���R���Ra���Rc���(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyRr������s���		(���R���t���__revision__RV���t
���SCons.Node.FSR���t
���SCons.Utilt���objectR����R$���R���R���R���R���RM���RQ���Rr���(����(����(����s9���install/lib/scons-2.0.0.final.0/SCons/Scanner/__init__.pyt���<module>���s���	�
H