B
    ›³ëb  ã               @   s¸   d dl ZddlmZ dd„ Zdd„ Zdd	„ Zi Zd
dddddddddddddddddddddd d!d"d#d$d%d&d'gZx&eD ]Z	dee	< deej
j e	¡< qvW d(d)„ Zd/d+d,„Zd0d-d.„ZdS )1é    Né   )ÚScannerBasec                s   dd„ ‰ ‡ fdd„| D ƒS )Nc             S   s   t |  ¡ tjjjƒS )N)Ú
isinstanceZdisambiguateÚSConsÚNodeÚFSZDir)Ún© r	   ú0lib/python3.7/site-packages/SCons/Scanner/Dir.pyÚ<lambda>   ó    zonly_dirs.<locals>.<lambda>c                s   g | ]}ˆ |ƒr|‘qS r	   r	   )Ú.0Únode)Úis_Dirr	   r
   ú
<listcomp>   s    zonly_dirs.<locals>.<listcomp>r	   )Znodesr	   )r   r
   Ú	only_dirs   s    r   c              K   s$   t jjj| d< t| d< ttdf| ŽS )zRReturn a prototype Scanner instance for scanning
    directories for on-disk filesÚnode_factoryÚ	recursiveÚ
DirScanner)r   r   r   ÚEntryr   r   Úscan_on_disk)Úkwargsr	   r	   r
   r      s    r   c              K   s$   t jjj| d< d| d< ttdf| ŽS )zbReturn a prototype Scanner instance for "scanning"
    directory Nodes for their in-memory entriesr   Nr   ÚDirEntryScanner)r   r   r   r   r   Úscan_in_memory)r   r	   r	   r
   r   &   s    r   Ú.z..z	.sconsignz.sconsign.dblitez.sconsign.dirz.sconsign.pagz.sconsign.datz.sconsign.bakz.sconsign.dbz.sconsign_md5.dblitez.sconsign_sha1.dblitez.sconsign_sha256.dblitez.sconsign_md5z.sconsign_md5.dirz.sconsign_md5.pagz.sconsign_md5.datz.sconsign_md5.bakz.sconsign_md5.dbz.sconsign_sha1z.sconsign_sha1.dirz.sconsign_sha1.pagz.sconsign_sha1.datz.sconsign_sha1.bakz.sconsign_sha1.dbz.sconsign_sha256z.sconsign_sha256.dirz.sconsign_sha256.pagz.sconsign_sha256.datz.sconsign_sha256.bakz.sconsign_sha256.dbc             C   s   | t kS )N)Ú
skip_entry)Úkr	   r	   r
   r   [   r   r   r	   c          	   C   s`   y| j  |  ¡ ¡}W n ttfk
r,   g S X | j}xtt|ƒD ]}|d| ƒ q@W t| ||ƒS )a  
    Scans a directory for on-disk files and directories therein.

    Looking up the entries will add these to the in-memory Node tree
    representation of the file system, so all we have to do is just
    that and then call the in-memory scanning function.
    z./)	ZfsÚlistdirZget_abspathÚIOErrorÚOSErrorr   ÚfilterÚdo_not_scanr   )r   ÚenvÚpathZflistÚeÚfr	   r	   r
   r   ]   s    r   c                sH   y
| j ‰ W n tk
r   g S X ttttˆ  ¡ ƒƒƒ}‡ fdd„|D ƒS )z:
    "Scans" a Node.FS.Dir for its in-memory entries.
    c                s   g | ]}ˆ | ‘qS r	   r	   )r   r   )Úentriesr	   r
   r   }   s    z"scan_in_memory.<locals>.<listcomp>)r&   ÚAttributeErrorÚsortedr    r!   ÚlistÚkeys)r   r"   r#   Z
entry_listr	   )r&   r
   r   p   s    
r   )r	   )r	   )ZSCons.Node.FSr   Ú r   r   r   r   r   Zskip_entry_listÚskipr   r   Z_my_normcaser!   r   r   r	   r	   r	   r
   Ú<module>   sR   

