Пример #1
0
    def run(self, args):
        parser = OptionParser('-c+', '--class+', '-h', '--help', '-m', '--main')

        options, arguments = parser.parse(args)

        params = dict()

        for opt, val in options:
            if opt in ('-h', '--help'):
                print(__usage__)
                sys.exit(0)
            elif opt in ('-m', '--main'):
                params['main'] = True
            elif opt in ('-c', '--class'):
                params['class'] = val

        # Simple check for an filename arguments
        if len(args) < 1:
            print('A filename is required to output the generated code')
            print(__usage__)
            sys.exit(1)

        # Generate the code
        for filename in arguments:
            PythonGenerator(filename = filename, **params).write()
Пример #2
0
    def run(self, args):
        parser = OptionParser('-h', '--help')
        options, arguments = parser.parse(args)

        for opt, val in options:
            if opt in ('-h', '--help'):
                print(__usage__)
                sys.exit(0)

        # Simple check for an target argument
        if len(args) < 1:
            print('A target is required to output the generated code')
            print(__usage__)
            sys.exit(1)

        # Generate the code
        MakefileGenerator(target = arguments[0]).write()
Пример #3
0
    def run(self, args):
        parser = OptionParser('-h', '--help', '-l', '--library', 
                '-e', '--executable')
        options, arguments = parser.parse(args)

        params = dict()

        for opt, val in options:
            if opt in ('-h', '--help'):
                print(__usage__)
                sys.exit(0)
            elif opt in ('-l', '--library'):
                params['library'] = True
            elif opt in ('-e', '--executable'):
                params['executable'] = True

        # Simple check for an target argument
        if len(args) < 1:
            print('A target is required to output the generated code')
            print(__usage__)
            sys.exit(1)

        # Generate the code
        CMakeListsGenerator(target = arguments[0], **params).write()