[Mesa-dev] [PATCH 2/3] mapi: Add -o option to mapi_abi.py

Chad Versace chad at chad-versace.us
Mon Aug 15 23:14:55 PDT 2011


The -o option specifies the output file. If not specifified, output is
printed to stdout.

This is to pacify the Android build system, whose built-in rules for
generated files become grumpy when shell redirection is used.

Note: This is in preparation for porting i965 to Android.
CC: Chia-I Wu <olv at lunarg.com>,
Signed-off-by: Chad Versace <chad at chad-versace.us>
---
 src/mapi/mapi/mapi_abi.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index e3d3f65..23b3b5a 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -835,6 +835,8 @@ def parse_args():
             help='printer to use: %s' % (", ".join(printers)))
     parser.add_option('-m', '--mode', dest='mode',
             help='target user: %s' % (", ".join(modes)))
+    parser.add_option('-o', '--output-file', dest='output_file',
+            help='[default: stdout]')
 
     options, args = parser.parse_args()
     if not args or options.printer not in printers or \
@@ -855,6 +857,9 @@ def main():
 
     filename, options = parse_args()
 
+    if options.output_file is not None:
+        sys.stdout = open(options.output_file, 'w')
+
     if filename.endswith('.xml'):
         entries = abi_parse_xml(filename)
     else:
-- 
1.7.6



More information about the mesa-dev mailing list