diff options
Diffstat (limited to 'third_party/waf/waflib/extras/win32_opts.py')
-rw-r--r-- | third_party/waf/waflib/extras/win32_opts.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/third_party/waf/waflib/extras/win32_opts.py b/third_party/waf/waflib/extras/win32_opts.py index 28491cd328f..f8f41870567 100644 --- a/third_party/waf/waflib/extras/win32_opts.py +++ b/third_party/waf/waflib/extras/win32_opts.py @@ -1,10 +1,16 @@ #! /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 @@ -16,7 +22,7 @@ except AttributeError: 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 @@ -99,13 +105,7 @@ if Utils.is_win32: 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 @@ -126,7 +126,7 @@ if Utils.is_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: @@ -138,7 +138,7 @@ if Utils.is_win32: 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) @@ -148,12 +148,11 @@ if Utils.is_win32: 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: @@ -163,7 +162,6 @@ if Utils.is_win32: node = self.find_node(lst) if node: if not node.isfile_cached(): - node.sig = None try: node.parent.mkdir() except OSError: @@ -173,3 +171,4 @@ if Utils.is_win32: node.parent.mkdir() return node Node.Node.find_or_declare = find_or_declare_win32 + |