From 64481e7a6835d1ba04817105518511fe8b23e3b0 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 31 Mar 2006 14:55:55 +0000 Subject: [PATCH] Fixed a bug: do not compare if the template does not exist yet. git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@46 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- dotfiles2html/dotfiles2html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dotfiles2html/dotfiles2html.py b/dotfiles2html/dotfiles2html.py index 8952fe8..5042619 100755 --- a/dotfiles2html/dotfiles2html.py +++ b/dotfiles2html/dotfiles2html.py @@ -69,8 +69,8 @@ for i, (fname, ftype) in enumerate(file_types): else: next = file_types[i+1][0] add_headers(fname, prev, next) - if not filecmp.cmp(fname + ".html", fname + ".tmpl"): - os.rename(fname + ".html", fname + ".tmpl") - else: + if os.path.exists(fname + ".tmpl") and filecmp.cmp(fname + ".html", fname + ".tmpl"): os.remove(fname + ".html") + else: + os.rename(fname + ".html", fname + ".tmpl") os.chmod(fname, 0644) -- 2.39.2