From a0d2d3446649066e7f03560953b5962d9fdcadf5 Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 20:07:31 +0200 Subject: [PATCH] shutil.copytree seems to throw OSError exception too So revert to previous Exception handling --- pelican/tools/pelican_themes.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 0083dd50..d13e60e9 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -181,18 +181,19 @@ def install(path, v=False, u=False): try: shutil.copytree(path, theme_path) - if os.name == 'posix': - for root, dirs, files in os.walk(theme_path): - for d in dirs: - dname = os.path.join(root, d) - os.chmod(dname, 0755) - for f in files: - fname = os.path.join(root, f) - os.chmod(fname, 0644) - except shutil.Error, e: + try: + if os.name == 'posix': + for root, dirs, files in os.walk(theme_path): + for d in dirs: + dname = os.path.join(root, d) + os.chmod(dname, 0755) + for f in files: + fname = os.path.join(root, f) + os.chmod(fname, 0644) + except OSError, e: + err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) + except Exception, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) - except OSError, e: - err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) def symlink(path, v=False):