[Treepkg-commits] r397 - branches/treepkg-status/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Aug 2 17:36:14 CEST 2010


Author: bricks
Date: 2010-08-02 17:36:12 +0200 (Mon, 02 Aug 2010)
New Revision: 397

Modified:
   branches/treepkg-status/treepkg/packager.py
Log:
be more error prone in listing different files
not checking if a dir exists caused several errors if a build wasn't successful


Modified: branches/treepkg-status/treepkg/packager.py
===================================================================
--- branches/treepkg-status/treepkg/packager.py	2010-08-02 10:41:55 UTC (rev 396)
+++ branches/treepkg-status/treepkg/packager.py	2010-08-02 15:36:12 UTC (rev 397)
@@ -8,6 +8,7 @@
 """Classes to automatically build debian packages from subversion checkouts"""
 
 import os
+import os.path
 import time
 import re
 import logging
@@ -325,11 +326,12 @@
 
     def get_log_files(self, logs=None):
         files = []
-        for f in os.listdir(self.log_dir):
-            if logs is None or f in logs:
-                f = os.path.join(self.log_dir,f)
-                if os.path.isfile(f):
-                    files.append((self.get_log_title(f),f))
+        if os.path.isdir(self.log_dir):
+            for f in os.listdir(self.log_dir):
+                if logs is None or f in logs:
+                    f = os.path.join(self.log_dir,f)
+                    if os.path.isfile(f):
+                        files.append((self.get_log_title(f),f))
         return files
         
     def list_log_files(self, logs):
@@ -349,14 +351,20 @@
         The implementation assumes that all files in self.src_dir belong
         to the source package.
         """
-        return sorted(util.listdir_abs(self.src_dir))
+        files = []
+        if os.path.isdir(self.src_dir):
+            files = sorted(util.listdir_abs(self.src_dir))
+        return files
 
     def list_binary_files(self):
         """Returns a list with the names of the files of the binary packages.
         The implementation assumes that all files in self.binary_dir belong
         to the binary packages.
         """
-        return sorted(util.listdir_abs(self.binary_dir))
+        files = []
+        if os.path.isdir(self.binary_dir):
+            files = sorted(util.listdir_abs(self.binary_dir))
+        return files
 
     def package(self):
         try:



More information about the Treepkg-commits mailing list