From: Oleg Broytman Date: Thu, 11 Feb 2010 17:11:07 +0000 (+0000) Subject: Restructured the code in the loop. X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=dc23b883f02e402c6172d66c5a91a85eb2b97f91;p=phdru.name%2Fphdru.name.git Restructured the code in the loop. git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@97 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- diff --git a/dotfiles2html/dotfiles2html.py b/dotfiles2html/dotfiles2html.py index 5d0d04d..9df4392 100755 --- a/dotfiles2html/dotfiles2html.py +++ b/dotfiles2html/dotfiles2html.py @@ -71,22 +71,23 @@ for i, (fname, ftype) in enumerate(file_types): file = open('vimrc', 'w') file.write(text.replace('', '')) file.close() - if os.path.exists(fname): - os.system("""exec gvim -f -c "set filetype=%s" -c ":source %s/dotfile2html.vim" "%s" - """ % (ftype, home_dir, fname)) - if i == 0: - prev = None - else: - prev = file_types[i-1][0] - if i >= ft_len - 1: - next = None - else: - next = file_types[i+1][0] - add_headers(fname, prev, next) - if os.path.exists(fname + ".tmpl") and filecmp.cmp(fname + ".html", fname + ".tmpl"): - os.remove(fname + ".html") - else: - os.rename(fname + ".html", fname + ".tmpl") + if not os.path.exists(fname): + continue + os.system("""exec gvim -f -c "set filetype=%s" -c ":source %s/dotfile2html.vim" "%s" + """ % (ftype, home_dir, fname)) + if i == 0: + prev = None + else: + prev = file_types[i-1][0] + if i >= ft_len - 1: + next = None + else: + next = file_types[i+1][0] + add_headers(fname, prev, next) + if os.path.exists(fname + ".tmpl") and filecmp.cmp(fname + ".html", fname + ".tmpl"): + os.remove(fname + ".html") + else: + os.rename(fname + ".html", fname + ".tmpl") if fname == 'vimrc' and os.path.exists('.' + fname): shutil.copy2('.' + fname, fname) if fname.endswith('.py'):