[open-ils-commits] r16605 - trunk/build/i18n/scripts (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jun 7 01:15:55 EDT 2010


Author: dbs
Date: 2010-06-07 01:15:52 -0400 (Mon, 07 Jun 2010)
New Revision: 16605

Modified:
   trunk/build/i18n/scripts/dojo_resource.py
Log:
In Dojo i18n script: create output directories if they don't exist


Modified: trunk/build/i18n/scripts/dojo_resource.py
===================================================================
--- trunk/build/i18n/scripts/dojo_resource.py	2010-06-07 05:00:16 UTC (rev 16604)
+++ trunk/build/i18n/scripts/dojo_resource.py	2010-06-07 05:15:52 UTC (rev 16605)
@@ -35,6 +35,7 @@
 import sys
 import simplejson
 import os.path
+import os
 
 class DojoResource (basel10n.BaseL10N):
     """
@@ -58,6 +59,7 @@
         # Avoid generating duplicate entries by keeping track of msgids
         msgids = dict()
 
+	#print("Reading Dojo resource file %s" % (source))
         bundle = simplejson.load(codecs.open(source, encoding='utf-8', mode='r'))
 
         for key, value in bundle.iteritems():
@@ -110,6 +112,8 @@
     if options.pot:
         pot.get_strings(options.pot)
         if options.outfile:
+            if not os.path.exists(options.outfile):
+                os.makedirs(os.path.dirname(options.outfile))
             pot.savepot(options.outfile)
         else:
             sys.stdout.write(pot.pot.__str__())
@@ -119,6 +123,8 @@
         pot.loadpo(options.create)
         pot.create_bundle()
         if options.outfile:
+            if not os.path.exists(options.outfile):
+                os.makedirs(os.path.dirname(options.outfile))
             outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
             simplejson.dump(pot.msgs, outfile, indent=4)
         else:



More information about the open-ils-commits mailing list