# HG changeset patch # User Bjoern Ricks # Date 1280763372 0 # Node ID 48577b11375f9aedad217a344bfbfd516c9a5cbf # Parent eab777e1bafd8d4dbdf17a18c3bb2bd72b4c8dfc be more error prone in listing different files not checking if a dir exists caused several errors if a build wasn't successful diff -r eab777e1bafd -r 48577b11375f treepkg/packager.py --- 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: