OSDN Git Service

swr/rast: generators will create target directories
authorTim Rowley <timothy.o.rowley@intel.com>
Mon, 26 Jun 2017 17:34:24 +0000 (12:34 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Fri, 30 Jun 2017 18:26:19 +0000 (13:26 -0500)
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
src/gallium/drivers/swr/rasterizer/codegen/gen_common.py

index 07b455a..7f53ec6 100644 (file)
@@ -22,6 +22,7 @@
 # Python source
 from __future__ import print_function
 import os
+import errno
 import sys
 import argparse
 from mako.template import Template
@@ -62,6 +63,12 @@ class MakoTemplateWriter:
         '''
             Write template data to a file
         '''
+        if not os.path.exists(os.path.dirname(output_filename)):
+            try:
+                os.makedirs(os.path.dirname(output_filename))
+            except OSError as err:
+                if err.errno != errno.EEXIST:
+                    raise
         with open(output_filename, 'w') as outfile:
             print(MakoTemplateWriter.to_string(template_filename, **kwargs), file=outfile)