[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/devtools/waf/wafadmin
From: Thomas Nagy <tnagyemail-mail () yahoo ! fr>
Date: 2006-09-30 18:50:23
Message-ID: 1159642223.008816.20246.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 590756 by tnagy:
Disable the 2.4 versions of Build.py scan_src_path and scan_path until looking good enough.
M +139 -156 Build.py
--- trunk/playground/devtools/waf/wafadmin/Build.py #590755:590756
@@ -335,7 +335,7 @@
#debug("rescanning "+str(src_dir_node))
# list the files in the src directory, adding the signatures
- files = self._scan_src_path(src_dir_node, src_dir_node.abspath(), src_dir_node.files())
+ files = self.scan_src_path(src_dir_node, src_dir_node.abspath(), src_dir_node.files())
#debug("files found in folder are "+str(files))
src_dir_node.set_files(files)
@@ -345,7 +345,7 @@
for variant in Utils.to_list(self._variants):
sub_path = Utils.join_path(self.m_bldnode.abspath(), variant , *lst)
try:
- files = self._scan_path(src_dir_node, sub_path, src_dir_node.build(), variant)
+ files = self.scan_path(src_dir_node, sub_path, src_dir_node.build(), variant)
src_dir_node.set_build(files)
except OSError:
#debug("osError on " + sub_path)
@@ -374,178 +374,98 @@
return 1
# ======================================= #
- if not sys.version_info[:2] < [2,4]:
- def _scan_src_path(self, i_parent_node, i_path, i_existing_nodes):
+ def scan_src_path(self, i_parent_node, i_path, i_existing_nodes):
- # read the dir contents, ignore the folders in it
- l_names_read = os.listdir(i_path)
+ # read the dir contents, ignore the folders in it
+ l_names_read = os.listdir(i_path)
- debug("folder contents "+str(l_names_read))
+ debug("folder contents "+str(l_names_read))
- # there are two ways to obtain the partitions:
- # 1 run the comparisons two times (not very smart)
- # 2 reduce the sizes of the list while looping
+ # there are two ways to obtain the partitions:
+ # 1 run the comparisons two times (not very smart)
+ # 2 reduce the sizes of the list while looping
- l_names = set(l_names_read)
- l_nodes = i_existing_nodes
- l_kept = []
- l_kept_names = set()
+ l_names = l_names_read
+ l_nodes = i_existing_nodes
+ l_kept = []
- for node in l_nodes:
- if node.m_name in l_names:
+ for node in l_nodes:
+ i = 0
+ name = node.m_name
+ l_len = len(l_names)
+ while i < l_len:
+ if l_names[i] == name:
l_kept.append(node)
- l_kept_names.add(node.m_name)
+ break
+ i += 1
+ if i < l_len:
+ del l_names[i]
- l_new_files = l_names.difference(l_kept_names)
-
- # Now:
- # l_names contains the new nodes (or files)
- # l_kept contains only nodes that actually exist on the filesystem
- for node in l_kept:
- try:
- # update the time stamp
- self.m_tstamp_variants[0][node] = Params.h_file(node.abspath())
- except:
- fatal("a file is readonly or has become a dir "+node.abspath())
+ # Now:
+ # l_names contains the new nodes (or files)
+ # l_kept contains only nodes that actually exist on the filesystem
+ for node in l_kept:
+ try:
+ # update the time stamp
+ self.m_tstamp_variants[0][node] = Params.h_file(node.abspath())
+ except:
+ fatal("a file is readonly or has become a dir "+node.abspath())
- debug("new files found "+str(l_names))
+ debug("new files found "+str(l_names))
- for name in l_new_files:#l_names:
- try:
- # will throw an exception if not a file or if not readable
- # we assume that this is better than performing a stat() first
- # TODO is it possible to distinguish the cases ?
- st = Params.h_file(Utils.join_path(i_path,name))
- l_child = Node.Node(name, i_parent_node)
- except:
- continue
- self.m_tstamp_variants[0][l_child] = st
- l_kept.append(l_child)
- return l_kept
+ l_path = i_path + os.sep
+ for name in l_names:
+ try:
+ # will throw an exception if not a file or if not readable
+ # we assume that this is better than performing a stat() first
+ # TODO is it possible to distinguish the cases ?
+ st = Params.h_file(l_path + name)
+ l_child = Node.Node(name, i_parent_node)
+ except:
+ continue
+ self.m_tstamp_variants[0][l_child] = st
+ l_kept.append(l_child)
+ return l_kept
- def _scan_path(self, i_parent_node, i_path, i_existing_nodes, i_variant):
- """in this function we do not add timestamps but we remove them
- when the files no longer exist (file removed in the build dir)"""
+ def scan_path(self, i_parent_node, i_path, i_existing_nodes, i_variant):
+ """in this function we do not add timestamps but we remove them
+ when the files no longer exist (file removed in the build dir)"""
- # read the dir contents, ignore the folders in it
- l_names_read = os.listdir(i_path)
+ # read the dir contents, ignore the folders in it
+ l_names_read = os.listdir(i_path)
- # there are two ways to obtain the partitions:
- # 1 run the comparisons two times (not very smart)
- # 2 reduce the sizes of the list while looping
+ # there are two ways to obtain the partitions:
+ # 1 run the comparisons two times (not very smart)
+ # 2 reduce the sizes of the list while looping
- l_names = set(l_names_read)
- l_node_names = set()
- l_nodes = i_existing_nodes
- l_rm = []
+ l_names = l_names_read
+ l_nodes = i_existing_nodes
+ l_rm = []
- for node in l_nodes:
- if not node.m_name in l_names:
- l_rm.append(node)
+ for node in l_nodes:
+ i = 0
+ name = node.m_name
+ l_len = len(l_names)
+ while i < l_len:
+ if l_names[i] == name:
+ break
+ i += 1
+ if i < l_len:
+ del l_names[i]
+ else:
+ l_rm.append(node)
- # remove the stamps of the nodes that no longer exist in the build dir
- for node in l_rm:
- #print "\nremoving the timestamp of ", node, node.m_name
- #print node.m_parent.m_build
- #print l_names_read
- #print l_names
+ # remove the stamps of the nodes that no longer exist in the build dir
+ for node in l_rm:
- if node in self.m_tstamp_variants[i_variant]:
- self.m_tstamp_variants[i_variant].__delitem__(node)
- return l_nodes
- else:
- def _scan_src_path(self, i_parent_node, i_path, i_existing_nodes):
-
- # read the dir contents, ignore the folders in it
- l_names_read = os.listdir(i_path)
-
- debug("folder contents "+str(l_names_read))
-
- # there are two ways to obtain the partitions:
- # 1 run the comparisons two times (not very smart)
- # 2 reduce the sizes of the list while looping
-
- l_names = l_names_read
- l_nodes = i_existing_nodes
- l_kept = []
-
- for node in l_nodes:
- i = 0
- name = node.m_name
- l_len = len(l_names)
- while i < l_len:
- if l_names[i] == name:
- l_kept.append(node)
- break
- i += 1
- if i < l_len:
- del l_names[i]
-
- # Now:
- # l_names contains the new nodes (or files)
- # l_kept contains only nodes that actually exist on the filesystem
- for node in l_kept:
- try:
- # update the time stamp
- self.m_tstamp_variants[0][node] = Params.h_file(node.abspath())
- except:
- fatal("a file is readonly or has become a dir "+node.abspath())
-
- debug("new files found "+str(l_names))
-
- l_path = i_path + os.sep
- for name in l_names:
- try:
- # will throw an exception if not a file or if not readable
- # we assume that this is better than performing a stat() first
- # TODO is it possible to distinguish the cases ?
- st = Params.h_file(l_path + name)
- l_child = Node.Node(name, i_parent_node)
- except:
- continue
- self.m_tstamp_variants[0][l_child] = st
- l_kept.append(l_child)
- return l_kept
-
- def _scan_path(self, i_parent_node, i_path, i_existing_nodes, i_variant):
- """in this function we do not add timestamps but we remove them
- when the files no longer exist (file removed in the build dir)"""
-
- # read the dir contents, ignore the folders in it
- l_names_read = os.listdir(i_path)
-
- # there are two ways to obtain the partitions:
- # 1 run the comparisons two times (not very smart)
- # 2 reduce the sizes of the list while looping
-
- l_names = l_names_read
- l_nodes = i_existing_nodes
- l_rm = []
-
- for node in l_nodes:
- i = 0
- name = node.m_name
- l_len = len(l_names)
- while i < l_len:
- if l_names[i] == name:
- break
- i += 1
- if i < l_len:
- del l_names[i]
- else:
- l_rm.append(node)
-
- # remove the stamps of the nodes that no longer exist in the build dir
- for node in l_rm:
-
- #print "\nremoving the timestamp of ", node, node.m_name
- #print node.m_parent.m_build
- #print l_names_read
+ #print "\nremoving the timestamp of ", node, node.m_name
+ #print node.m_parent.m_build
+ #print l_names_read
#print l_names
- if node in self.m_tstamp_variants[i_variant]:
- self.m_tstamp_variants[i_variant].__delitem__(node)
- return l_nodes
+ if node in self.m_tstamp_variants[i_variant]:
+ self.m_tstamp_variants[i_variant].__delitem__(node)
+ return l_nodes
def dump(self):
"for debugging"
@@ -622,3 +542,66 @@
"deprecated"
warning('use bld.create_obj instead of bld.createObj')
return self.create_obj(objname, *k, **kw)
+
+
+if 0: #sys.version_info[:2] < [2,3]:
+ def scan_src_path(self, i_parent_node, i_path, i_existing_nodes):
+ l_names_read = os.listdir(i_path)
+
+ l_names = set(l_names_read)
+ l_nodes = i_existing_nodes
+ l_kept = []
+ l_kept_names = set()
+
+ for node in l_nodes:
+ if node.m_name in l_names:
+ l_kept.append(node)
+ l_kept_names.add(node.m_name)
+
+ l_new_files = l_names.difference(l_kept_names)
+
+ # Now:
+ # l_names contains the new nodes (or files)
+ # l_kept contains only nodes that actually exist on the filesystem
+ for node in l_kept:
+ try:
+ # update the time stamp
+ self.m_tstamp_variants[0][node] = Params.h_file(node.abspath())
+ except:
+ fatal("a file is readonly or has become a dir "+node.abspath())
+
+ debug("new files found "+str(l_names))
+
+ for name in l_new_files:#l_names:
+ try:
+ # will throw an exception if not a file or if not readable
+ # we assume that this is better than performing a stat() first
+ # TODO is it possible to distinguish the cases ?
+ st = Params.h_file(Utils.join_path(i_path,name))
+ l_child = Node.Node(name, i_parent_node)
+ except:
+ continue
+ self.m_tstamp_variants[0][l_child] = st
+ l_kept.append(l_child)
+ return l_kept
+
+ def scan_path(self, i_parent_node, i_path, i_existing_nodes, i_variant):
+ l_names_read = os.listdir(i_path)
+
+ l_names = set(l_names_read)
+ l_node_names = set()
+ l_nodes = i_existing_nodes
+ l_rm = []
+
+ for node in l_nodes:
+ if not node.m_name in l_names:
+ l_rm.append(node)
+
+ for node in l_rm:
+ if node in self.m_tstamp_variants[i_variant]:
+ self.m_tstamp_variants[i_variant].__delitem__(node)
+ return l_nodes
+
+ Build.scan_src_path = scan_src_path
+ Build.scan_path = scan_path
+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic