changeset 437:48577b11375f treepkg-status

be more error prone in listing different files not checking if a dir exists caused several errors if a build wasn't successful
author Bjoern Ricks <bricks@intevation.de>
date Mon, 02 Aug 2010 15:36:12 +0000
parents eab777e1bafd
children 3a3cad8f6f60
files treepkg/packager.py
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/packager.py	Mon Aug 02 10:41:55 2010 +0000
+++ b/treepkg/packager.py	Mon Aug 02 15:36:12 2010 +0000
@@ -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:
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)