Dir.py (scons-4.2.0) | : | Dir.py (SCons-4.3.0) | ||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
# | # | |||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | |||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | |||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
import SCons.Node.FS | import SCons.Node.FS | |||
import SCons.Scanner | from . import ScannerBase | |||
def only_dirs(nodes): | def only_dirs(nodes): | |||
is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir) | is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir) | |||
return [node for node in nodes if is_Dir(node)] | return [node for node in nodes if is_Dir(node)] | |||
def DirScanner(**kw): | def DirScanner(**kwargs): | |||
"""Return a prototype Scanner instance for scanning | """Return a prototype Scanner instance for scanning | |||
directories for on-disk files""" | directories for on-disk files""" | |||
kw['node_factory'] = SCons.Node.FS.Entry | kwargs['node_factory'] = SCons.Node.FS.Entry | |||
kw['recursive'] = only_dirs | kwargs['recursive'] = only_dirs | |||
return SCons.Scanner.Base(scan_on_disk, "DirScanner", **kw) | return ScannerBase(scan_on_disk, "DirScanner", **kwargs) | |||
def DirEntryScanner(**kw): | def DirEntryScanner(**kwargs): | |||
"""Return a prototype Scanner instance for "scanning" | """Return a prototype Scanner instance for "scanning" | |||
directory Nodes for their in-memory entries""" | directory Nodes for their in-memory entries""" | |||
kw['node_factory'] = SCons.Node.FS.Entry | kwargs['node_factory'] = SCons.Node.FS.Entry | |||
kw['recursive'] = None | kwargs['recursive'] = None | |||
return SCons.Scanner.Base(scan_in_memory, "DirEntryScanner", **kw) | return ScannerBase(scan_in_memory, "DirEntryScanner", **kwargs) | |||
skip_entry = {} | skip_entry = {} | |||
skip_entry_list = [ | skip_entry_list = [ | |||
'.', | '.', | |||
'..', | '..', | |||
'.sconsign', | '.sconsign', | |||
# Used by the native dblite.py module. | # Used by the native dblite.py module. | |||
'.sconsign.dblite', | '.sconsign.dblite', | |||
# Used by dbm and dumbdbm. | # Used by dbm and dumbdbm. | |||
'.sconsign.dir', | '.sconsign.dir', | |||
# Used by dbm. | # Used by dbm. | |||
'.sconsign.pag', | '.sconsign.pag', | |||
# Used by dumbdbm. | # Used by dumbdbm. | |||
'.sconsign.dat', | '.sconsign.dat', | |||
'.sconsign.bak', | '.sconsign.bak', | |||
# Used by some dbm emulations using Berkeley DB. | # Used by some dbm emulations using Berkeley DB. | |||
'.sconsign.db', | '.sconsign.db', | |||
# new filenames since multiple hash formats allowed: | ||||
'.sconsign_md5.dblite', | ||||
'.sconsign_sha1.dblite', | ||||
'.sconsign_sha256.dblite', | ||||
# and all the duplicate files for each sub-sconsfile type | ||||
'.sconsign_md5', | ||||
'.sconsign_md5.dir', | ||||
'.sconsign_md5.pag', | ||||
'.sconsign_md5.dat', | ||||
'.sconsign_md5.bak', | ||||
'.sconsign_md5.db', | ||||
'.sconsign_sha1', | ||||
'.sconsign_sha1.dir', | ||||
'.sconsign_sha1.pag', | ||||
'.sconsign_sha1.dat', | ||||
'.sconsign_sha1.bak', | ||||
'.sconsign_sha1.db', | ||||
'.sconsign_sha256', | ||||
'.sconsign_sha256.dir', | ||||
'.sconsign_sha256.pag', | ||||
'.sconsign_sha256.dat', | ||||
'.sconsign_sha256.bak', | ||||
'.sconsign_sha256.db', | ||||
] | ] | |||
for skip in skip_entry_list: | for skip in skip_entry_list: | |||
skip_entry[skip] = 1 | skip_entry[skip] = 1 | |||
skip_entry[SCons.Node.FS._my_normcase(skip)] = 1 | skip_entry[SCons.Node.FS._my_normcase(skip)] = 1 | |||
do_not_scan = lambda k: k not in skip_entry | do_not_scan = lambda k: k not in skip_entry | |||
def scan_on_disk(node, env, path=()): | def scan_on_disk(node, env, path=()): | |||
""" | """ | |||
End of changes. 6 change blocks. | ||||
9 lines changed or deleted | 32 lines changed or added |