[projects/git-slug: 169/170] slug_watch: Avoid error if projects.list.head does not exist
glen
glen at pld-linux.org
Mon Sep 21 21:53:01 CEST 2015
commit 1b97e58e91806093a321a501c9a86a1b5ca09cbc
Author: Kacper Kornet <draenog at pld-linux.org>
Date: Thu Aug 15 13:35:59 2013 +0100
slug_watch: Avoid error if projects.list.head does not exist
slug_watch | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/slug_watch b/slug_watch
index 7b64460..70a7b2b 100755
--- a/slug_watch
+++ b/slug_watch
@@ -63,10 +63,11 @@ def process_file(pathname):
print('{} is not an ordinary file'.format(pathname))
return
- try:
- shutil.copyfile(PROJECTS_LIST_HEAD, PROJECTS_LIST_NEW)
- except (OSError, shutil.Error):
- logger.error('Cannot write {}'.format(PROJECTS_LIST_NEW))
+ if os.path.isfile(PROJECTS_LIST_HEAD):
+ try:
+ shutil.copyfile(PROJECTS_LIST_HEAD, PROJECTS_LIST_NEW)
+ except (OSError, shutil.Error):
+ logger.error('Cannot write {}'.format(PROJECTS_LIST_NEW))
with open(os.path.join(REFREPO_WDIR, REFFILE),'w') as headfile_new, open(pathname, 'r') as newfile, \
open(PROJECTS_LIST_NEW,'a') as projects:
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5
More information about the pld-cvs-commit
mailing list