Mercurial > treepkg > treepkg
comparison treepkg/packager.py @ 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 | 2db42a2a9db9 |
children | eadcb1bb54e2 |
comparison
equal
deleted
inserted
replaced
436:eab777e1bafd | 437:48577b11375f |
---|---|
6 # Read the file COPYING coming with the software for details. | 6 # Read the file COPYING coming with the software for details. |
7 | 7 |
8 """Classes to automatically build debian packages from subversion checkouts""" | 8 """Classes to automatically build debian packages from subversion checkouts""" |
9 | 9 |
10 import os | 10 import os |
11 import os.path | |
11 import time | 12 import time |
12 import re | 13 import re |
13 import logging | 14 import logging |
14 import shutil | 15 import shutil |
15 import datetime | 16 import datetime |
323 return self.build_log + ".gz" | 324 return self.build_log + ".gz" |
324 return self.build_log | 325 return self.build_log |
325 | 326 |
326 def get_log_files(self, logs=None): | 327 def get_log_files(self, logs=None): |
327 files = [] | 328 files = [] |
328 for f in os.listdir(self.log_dir): | 329 if os.path.isdir(self.log_dir): |
329 if logs is None or f in logs: | 330 for f in os.listdir(self.log_dir): |
330 f = os.path.join(self.log_dir,f) | 331 if logs is None or f in logs: |
331 if os.path.isfile(f): | 332 f = os.path.join(self.log_dir,f) |
332 files.append((self.get_log_title(f),f)) | 333 if os.path.isfile(f): |
334 files.append((self.get_log_title(f),f)) | |
333 return files | 335 return files |
334 | 336 |
335 def list_log_files(self, logs): | 337 def list_log_files(self, logs): |
336 """Returns a list describing the logfiles available for the revision. | 338 """Returns a list describing the logfiles available for the revision. |
337 Each list item is a tuple of the form (TITLE, FILENAME) where | 339 Each list item is a tuple of the form (TITLE, FILENAME) where |
347 def list_source_files(self): | 349 def list_source_files(self): |
348 """Returns a list with the names of the files of the source package. | 350 """Returns a list with the names of the files of the source package. |
349 The implementation assumes that all files in self.src_dir belong | 351 The implementation assumes that all files in self.src_dir belong |
350 to the source package. | 352 to the source package. |
351 """ | 353 """ |
352 return sorted(util.listdir_abs(self.src_dir)) | 354 files = [] |
355 if os.path.isdir(self.src_dir): | |
356 files = sorted(util.listdir_abs(self.src_dir)) | |
357 return files | |
353 | 358 |
354 def list_binary_files(self): | 359 def list_binary_files(self): |
355 """Returns a list with the names of the files of the binary packages. | 360 """Returns a list with the names of the files of the binary packages. |
356 The implementation assumes that all files in self.binary_dir belong | 361 The implementation assumes that all files in self.binary_dir belong |
357 to the binary packages. | 362 to the binary packages. |
358 """ | 363 """ |
359 return sorted(util.listdir_abs(self.binary_dir)) | 364 files = [] |
365 if os.path.isdir(self.binary_dir): | |
366 files = sorted(util.listdir_abs(self.binary_dir)) | |
367 return files | |
360 | 368 |
361 def package(self): | 369 def package(self): |
362 try: | 370 try: |
363 util.ensure_directory(self.work_dir) | 371 util.ensure_directory(self.work_dir) |
364 self.status.start = datetime.datetime.utcnow() | 372 self.status.start = datetime.datetime.utcnow() |