From d9b747a5447968e05d1214e9a7769a648603f339 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Tue, 16 Dec 2008 21:29:35 +0000 Subject: [PATCH] Revert "try to make icon-render-script more robust regarding the output destination" This reverts commit bd538edfe9f8d17ce01adae98391cab9dbd46229. Conflicts: admin/render-icon.py --- admin/render-icon.py | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/admin/render-icon.py b/admin/render-icon.py index 4b0d464ca..bf9715bc9 100755 --- a/admin/render-icon.py +++ b/admin/render-icon.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# + # render-icons.py - Icon rendering utility script # # Copyright (C) Lumiera.org @@ -20,10 +20,9 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sys -import os -import os.path as Path import getopt from xml.dom import minidom +import os import shutil #svgDir = "svg" @@ -33,20 +32,14 @@ rsvgPath = "./rsvg-convert" artworkLayerPrefix = "artwork:" def createDirectory( name ): - if Path.isfile(name): - print "WARNING: moving %s to %s.bak because it's in the way." % (name,name) - bak_name = name + ".bak" - if Path.isfile(bak_name): - os.remove(bak_name) - os.rename(name,bak_name) - if not Path.isdir(name): + if os.path.exists(name) == False: os.mkdir(name) def copyMergeDirectory( src, dst ): listing = os.listdir(src) for file_name in listing: - src_file_path = Path.join(src, file_name) - dst_file_path = Path.join(dst, file_name) + src_file_path = os.path.join(src, file_name) + dst_file_path = os.path.join(dst, file_name) shutil.copyfile(src_file_path, dst_file_path) def getDocumentSize( svg_element ): @@ -165,19 +158,19 @@ def main(argv): print "Missing arguments in_path and out_dir." sys.exit(1) - if Path.isfile(out_dir): + if os.path.isfile(out_dir): print "Unable to use '%s' as output directory, because it\'s a file." % out_dir sys.exit(1) - if not Path.isdir(out_dir): + if not os.path.isdir(out_dir): print "Output directory '%s' not found." % out_dir sys.exit(1) # Create the icons folders - createDirectory(Path.join(out_dir, "48x48")) - createDirectory(Path.join(out_dir, "32x32")) - createDirectory(Path.join(out_dir, "24x24")) - createDirectory(Path.join(out_dir, "22x22")) - createDirectory(Path.join(out_dir, "16x16")) + createDirectory(os.path.join(out_dir, "48x48")) + createDirectory(os.path.join(out_dir, "32x32")) + createDirectory(os.path.join(out_dir, "24x24")) + createDirectory(os.path.join(out_dir, "22x22")) + createDirectory(os.path.join(out_dir, "16x16")) renderSvgIcon(in_path, out_dir)