[Libreoffice-commits] core.git: bin/gbuild-to-ide

Peter Foley pefoley2 at pefoley.com
Wed Sep 24 11:04:44 PDT 2014


 bin/gbuild-to-ide |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

New commits:
commit 1a6737d3a008f75f2a5e08bae2732716440e37b5
Author: Peter Foley <pefoley2 at pefoley.com>
Date:   Wed Sep 24 13:21:50 2014 -0400

    Make gbuild-to-ide bail out before parsing if ide type is invalid
    
    Also fix the vim modeline to maintain consistant formatting
    
    Change-Id: Ia42ec2a69f9c3037a6390ca4f5c4198031b7aa64
    Reviewed-on: https://gerrit.libreoffice.org/11632
    Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
    Tested-by: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 2e8bc30..919f787 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -872,27 +872,26 @@ if __name__ == '__main__':
                         help='the input file, not normally used, for debugging this script')
     args = parser.parse_args()
     paths = {}
+    generators = {
+        'kdevelop': KdevelopIntegrationGenerator,
+        'xcode': XcodeIntegrationGenerator,
+        'vs2012': VisualStudioIntegrationGenerator,
+        'vim': VimIntegrationGenerator,
+        'debug': DebugIntegrationGenerator}
+
+    if args.ide not in generators.keys():
+        parser.print_help()
+        sys.exit(1)
+
     if args.input:
         gbuildparser = GbuildParser().parse(open(args.input, 'r'))
     else:
         gbuildparser = GbuildParser().parse(sys.stdin)
 
-    if args.ide == 'kdevelop':
-        KdevelopIntegrationGenerator(gbuildparser).emit()
-    elif args.ide == 'xcode':
-        XcodeIntegrationGenerator(gbuildparser).emit()
-    elif args.ide == 'vs2012':
-        VisualStudioIntegrationGenerator(gbuildparser).emit()
-    elif args.ide == 'vim':
-        VimIntegrationGenerator(gbuildparser).emit()
-    elif args.ide == 'debug':
-        DebugIntegrationGenerator(gbuildparser).emit()
-    else:
-        parser.print_help()
-        sys.exit(1)
+    generators[args.ide](gbuildparser).emit()
 
 # Local Variables:
 # indent-tabs-mode: nil
 # End:
 #
-# vim: set noet sw=4 ts=4:
+# vim: set et sw=4 ts=4:


More information about the Libreoffice-commits mailing list