Mesa (master): swr/rast: generators will create target directories

Tim Rowley torowley at kemper.freedesktop.org
Fri Jun 30 19:18:02 UTC 2017


Module: Mesa
Branch: master
Commit: ba64ddedc26278a4ce1fea66ae0938f11e20d9e8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba64ddedc26278a4ce1fea66ae0938f11e20d9e8

Author: Tim Rowley <timothy.o.rowley at intel.com>
Date:   Mon Jun 26 12:34:24 2017 -0500

swr/rast: generators will create target directories

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>

---

 src/gallium/drivers/swr/rasterizer/codegen/gen_common.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py
index 07b455a4e1..7f53ec6ad6 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py
@@ -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)
 




More information about the mesa-commit mailing list