From: Oleg Broytman Date: Fri, 31 Mar 2006 14:55:55 +0000 (+0000) Subject: Fixed a bug: do not compare if the template does not exist yet. X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=64481e7a6835d1ba04817105518511fe8b23e3b0;p=phdru.name%2Fphdru.name.git 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 --- 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)