Browse Source

Added pzkeep option

Josh Yelon 18 years ago
parent
commit
10e2a1847b
1 changed files with 12 additions and 3 deletions
  1. 12 3
      direct/src/directscripts/eggcacher.py

+ 12 - 3
direct/src/directscripts/eggcacher.py

@@ -27,11 +27,15 @@ class EggCacher:
         self.processFiles(files)
 
     def parseArgs(self, args):
-        self.concise =0
+        self.concise = 0
+        self.pzkeep = 0
         while len(args):
             if (args[0]=="--concise"):
                 self.concise = 1
                 args = args[1:]
+            elif (args[0]=="--pzkeep"):
+                self.pzkeep = 1
+                args = args[1:]
             else:
                 break
         if (len(args) < 1):
@@ -47,10 +51,15 @@ class EggCacher:
             for f in os.listdir(path):
                 self.scanPath(eggs, os.path.join(path,f))
             return
-        if (path.endswith(".egg")) or (path.endswith(".egg.pz")):
+        if (path.endswith(".egg")):
             size = os.path.getsize(path)
             eggs.append((path,size))
-        
+            return
+        if (path.endswith(".egg.pz")):
+            size = os.path.getsize(path)
+            if (self.pzkeep): eggs.append((path,size))
+            else: eggs.append((path[:-3],size))
+
     def scanPaths(self, paths):
         eggs = []
         for path in paths: