gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17406 - gnunet-update


From: gnunet
Subject: [GNUnet-SVN] r17406 - gnunet-update
Date: Wed, 12 Oct 2011 14:30:22 +0200

Author: harsha
Date: 2011-10-12 14:30:22 +0200 (Wed, 12 Oct 2011)
New Revision: 17406

Modified:
   gnunet-update/package.py
Log:
improved performance

Modified: gnunet-update/package.py
===================================================================
--- gnunet-update/package.py    2011-10-12 12:23:52 UTC (rev 17405)
+++ gnunet-update/package.py    2011-10-12 12:30:22 UTC (rev 17406)
@@ -48,6 +48,7 @@
 prefix_given = False
 config_options = list()
 binary_objects = list()
+#dependency cache
 dependencies = dict()
 
     
@@ -198,20 +199,21 @@
                     continue
                 #create a new dependency object and add it to the set
                 dep = Dependency(dep_data[0], dep_data[-1])
-                #Retrieve major number of the dependency
-                match = regex.match(dep_data[-1])
-                if match:
-                    match2 = None
-                    if os.path.islink(dep_data[-1]):
-                        match2 = regex.match(os.path.realpath(dep_data[-1]))
-                        
-                    (dep.major, 
-                     dep.minor, 
-                     dep.rev) = match2.groups() if match2 else match.groups()
-                else:
-                    raise Exception('Unhandled discrepancy.')
-                
+                #check in cache if we already saw this dependency
                 if dep not in dependencies:
+                    #Retrieve major number of the dependency
+                    match = regex.match(dep_data[-1])
+                    if match:
+                        match2 = None
+                        if os.path.islink(dep_data[-1]):
+                            match2 = 
regex.match(os.path.realpath(dep_data[-1]))
+                            
+                        (dep.major, 
+                         dep.minor, 
+                         dep.rev) = match2.groups() if match2 else 
match.groups()
+                    else:
+                        raise Exception('Unhandled discrepancy.')
+                    
                     dependencies[dep] = dep
                 else:
                     dep = dependencies[dep]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]