+#! /usr/bin/env python
+# encoding: utf-8
+# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
+
#! /usr/bin/env python
# encoding: utf-8
"""
Windows-specific optimizations
-This module can help reducing the overhead of listing files on windows (more than 10000 files).
+This module can help reducing the overhead of listing files on windows
+(more than 10000 files). Python 3.5 already provides the listdir
+optimization though.
"""
import os
TP = '%s\\*'
if Utils.is_win32:
- from waflib.extras import md5_tstamp
+ from waflib.Tools import md5_tstamp
import ctypes, ctypes.wintypes
FindFirstFile = ctypes.windll.kernel32.FindFirstFileW
pass
except AttributeError:
self.ctx.hash_cache = {}
-
- if not self.is_bld():
- if self.is_child_of(self.ctx.srcnode):
- self.sig = self.cached_hash_file()
- else:
- self.sig = Utils.h_file(self.abspath())
- self.ctx.hash_cache[id(self)] = ret = self.sig
+ self.ctx.hash_cache[id(self)] = ret = Utils.h_file(self.abspath())
return ret
Node.Node.get_bld_sig = get_bld_sig_win32
find = FindFirstFile(TP % curpath, ctypes.byref(findData))
if find == INVALID_HANDLE_VALUE:
- Logs.error("invalid win32 handle isfile_cached %r" % self.abspath())
+ Logs.error("invalid win32 handle isfile_cached %r", self.abspath())
return os.path.isfile(self.abspath())
try:
if not FindNextFile(find, ctypes.byref(findData)):
break
except Exception as e:
- Logs.error('exception while listing a folder %r %r' % (self.abspath(), e))
+ Logs.error('exception while listing a folder %r %r', self.abspath(), e)
return os.path.isfile(self.abspath())
finally:
FindClose(find)
def find_or_declare_win32(self, lst):
# assuming that "find_or_declare" is called before the build starts, remove the calls to os.path.isfile
if isinstance(lst, str):
- lst = [x for x in Node.split_path(lst) if x and x != '.']
+ lst = [x for x in Utils.split_path(lst) if x and x != '.']
- node = self.get_bld().search(lst)
+ node = self.get_bld().search_node(lst)
if node:
if not node.isfile_cached():
- node.sig = None
try:
node.parent.mkdir()
except OSError:
node = self.find_node(lst)
if node:
if not node.isfile_cached():
- node.sig = None
try:
node.parent.mkdir()
except OSError:
node.parent.mkdir()
return node
Node.Node.find_or_declare = find_or_declare_win32
+