Пример #1
0
    def print_help(self, file=None):
        # prepare list of available formats; we have to do it here, because
        # showFormats() may print warnings or errors to stderr and we don't
        # want that to happen in the middle of printing help
        if self.values.includes != None:
            addIncludePaths(self.values.includes)
        formatsList = formats.showFormats()

        if file is None:
            file = sys.stdout
        OptionParser.print_help(self, file)

        # show all available formats:
        file.write('\n%s' % formatsList)
Пример #2
0
    def print_help(self, file=None):
        # prepare list of available formats; we have to do it here, because
        # showFormats() may print warnings or errors to stderr and we don't
        # want that to happen in the middle of printing help
        if self.values.includes != None:
            addIncludePaths(self.values.includes)
        formatsList = formats.showFormats()

        if file is None:
            file = sys.stdout
        OptionParser.print_help(self, file)
   
        # show all available formats:
        file.write('\n%s' % formatsList)
Пример #3
0
        except KeyError:  # python < 2.3 didn't have protocol argument
            sys.stderr.write(
                "Warning: disabling XML cache because it's not supported by Python 2.2\n"
            )
        except Exception, e:
            sys.stderr.write(
                "Warning: disabling XML cache because an error occured while loading %s:\n         %s\n"
                % (options.xml_cache, e))

    formats.loadFormats()
    if options.format == None:
        parser.error('you must specify output format (use -f option)')
    config.format = options.format
    if not formats.isValidFormat(config.format):
        parser.error("unknown format '%s'\n\n" % config.format +
                     formats.showFormats())

    if options.deps_file != None:
        config.track_deps = 1
        config.deps_file = options.deps_file

    if options.changes_file != None:
        config.changes_file = options.changes_file

    if options.outfile != None:
        config.output_file = options.outfile
    else:
        fmt = formats.formats[config.format]
        if fmt.defaultFile == None or fmt.defaultFile == '':
            parser.error('you must specify output file (use -o option)')
        else:
Пример #4
0
        except ImportError:
            sys.stderr.write("Warning: disabling XML cache because it's not supported by this version of Python\n")
        except AttributeError: # python < 2.3 didn't have HIGHEST_PROTOCOL
            sys.stderr.write("Warning: disabling XML cache because it's not supported by Python 2.2\n")
        except KeyError: # python < 2.3 didn't have protocol argument
            sys.stderr.write("Warning: disabling XML cache because it's not supported by Python 2.2\n")
        except Exception, e:
            sys.stderr.write("Warning: disabling XML cache because an error occured while loading %s:\n         %s\n" % (options.xml_cache, e))

    formats.loadFormats()
    if options.format == None:
        parser.error('you must specify output format (use -f option)')
    config.format = options.format
    if not formats.isValidFormat(config.format):
        parser.error("unknown format '%s'\n\n" % config.format +
                     formats.showFormats())

    if options.deps_file != None:
        config.track_deps = 1
        config.deps_file = options.deps_file

    if options.changes_file != None:
        config.changes_file = options.changes_file
    
    if options.outfile != None:
        config.output_file = options.outfile
    else:
        fmt = formats.formats[config.format]
        if fmt.defaultFile == None or fmt.defaultFile == '':
            parser.error('you must specify output file (use -o option)')
        else: