[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/devtools/miniscons
From: Thomas Nagy <tnagyemail-mail () yahoo ! fr>
Date: 2005-10-26 17:42:44
Message-ID: 1130348564.342193.30459.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 474549 by tnagy:
Reading, merging and writing a tree back to disk works now
M +29 -34 deptree.py
--- trunk/playground/devtools/miniscons/deptree.py #474548:474549
@@ -70,8 +70,8 @@
self.m_type=0 # 0 for file, 1 for dir, 2 for link
# signatures
- self.m_cachedstamp=""
self.m_newstamp=""
+ self.m_oldstamp=""
# used for sorting nodes
def __cmp__(self, other):
@@ -124,18 +124,23 @@
print "Attempt to update the tree with another filesystem!"
return
- i=1
+ i=0
size = len(plst)
curnode = self.m_root
- found=0
while i<size:
- found=0
dirname=plst[i]
i+=1
+ #print "dirname is "+dirname
+ #print "keys are ",
+ #print curnode.m_dirs.keys()
+
+ if not dirname: continue
if curnode.m_dirs.has_key(dirname):
+ #print "node exists"
# the node exists
+ curnode = curnode.m_dirs[dirname]
continue
# else
@@ -161,6 +166,10 @@
# update recursively a tree from a node
def rextract(self, node_dir):
+ if not node_dir:
+ print "bug in rextract, passing None as node_dir"
+ return
+
# folders to exclude
if node_dir.m_name in self.m_excludes: return
@@ -169,7 +178,7 @@
try:
names = os.listdir(dirname)
except os.error:
- print "os error"
+ print "os error while listing "+dirname
return
# check each file
@@ -183,8 +192,8 @@
# create a file node if this one is not stored already
if node_dir.m_files.has_key(name):
- file.m_oldstamp = file.m_newstamp
- file.m_newstamp = signature(fullname)
+ node_dir.m_files[name].m_oldstamp = node_dir.m_files[name].m_newstamp
+ node_dir.m_files[name].m_newstamp = signature(fullname)
else:
n = node()
n.m_issource=1
@@ -199,13 +208,11 @@
elif os.path.isdir(fullname):
- # recursion
-
# create a dir node if not stored already
found_node = None
if node_dir.m_dirs.has_key(name):
- 0
+ found_node = node_dir.m_dirs[name]
else:
n = node()
n.m_issource=1
@@ -218,6 +225,7 @@
n.m_type = 1
node_dir.m_dirs[name]=n
+ # recursion
self.rextract(found_node)
elif os.path.islink(fullname):
@@ -244,7 +252,14 @@
# recursion
for file in node.m_files.keys():
accu+= printspaces(count)
- accu+= ">"+file+"\n"
+ accu+= ">"+file+" "
+
+ if node.m_files[file].m_newstamp != node.m_files[file].m_oldstamp:
+ accu += "\t\t\t(modified)"
+ #accu+= node.m_files[file].m_newstamp
+ #accu+= "< >"
+ #accu+= node.m_files[file].m_oldstamp
+ accu+="\n"
for dir in node.m_dirs.keys():
accu += recu(node.m_dirs[dir], count+1)
@@ -268,30 +283,10 @@
file.close()
def run():
-
- t = deptree()
- t.extract( os.path.abspath(".") )
- t.dump()
-
- """
- print "tree stored in the database"
tree = load()
- if tree:
- for node in tree.m_nodes: print node.toString()
- print "--"
+ tree.extract( os.path.abspath(".") )
+ tree.dump()
+ store(tree)
- dep = deptree()
- dep.extract( os.path.abspath(".") )
- for node in dep.m_nodes:
- print node.toString()
- print "loading files finished"
-
-
- dep.update(tree)
-
- print "storing"
- store(dep)
-"""
-
run()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic