def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('sources', nargs='+') options = parser.parse_args(args) retval = 0 lib_files = PartitionFiles(options.sources) directory_list = GetDirectoryList(PPAPI_DIR, relative_to=SRC_DIR) for lib_name, filenames in lib_files.iteritems(): if not filenames: continue changed_filenames, removed_filenames = \ GetChangedAndRemovedFilenames(filenames, directory_list) dsc_filename = GetDscFilenameFromLibraryName(lib_name) dsc = parse_dsc.LoadProject(dsc_filename) dsc_sources_and_headers = GetDscSourcesAndHeaders(dsc) # Use the relative path to the .dsc to make the error messages shorter. rel_dsc_filename = os.path.relpath(dsc_filename, SRC_DIR) is_private = lib_name == 'ppapi_cpp_private' if not VerifyOrPrintError(rel_dsc_filename, dsc_sources_and_headers, changed_filenames, removed_filenames, is_private=is_private): retval = 1 return retval
def main(args): usage = '%prog <file>...' description = __doc__ parser = optparse.OptionParser(usage=usage, description=description) args = parser.parse_args(args)[1] if not args: parser.error('Expected a PPAPI header or source file.') retval = 0 lib_files = PartitionFiles(args) directory_list = GetDirectoryList(PPAPI_DIR, relative_to=SRC_DIR) for lib_name, filenames in lib_files.iteritems(): if not filenames: continue changed_filenames, removed_filenames = \ GetChangedAndRemovedFilenames(filenames, directory_list) dsc_filename = GetDscFilenameFromLibraryName(lib_name) dsc = parse_dsc.LoadProject(dsc_filename) dsc_sources_and_headers = GetDscSourcesAndHeaders(dsc) # Use the relative path to the .dsc to make the error messages shorter. rel_dsc_filename = os.path.relpath(dsc_filename, SRC_DIR) is_private = lib_name == 'ppapi_cpp_private' if not VerifyOrPrintError(rel_dsc_filename, dsc_sources_and_headers, changed_filenames, removed_filenames, is_private=is_private): retval = 1 return retval
def DoMain(args): """Entry point for gyp's pymod_do_main command.""" parser = argparse.ArgumentParser(description=__doc__) # Give a clearer error message when this is used as a module. parser.prog = 'dsc_info' parser.add_argument('-s', '--sources', help='Print a list of source files for the target', action='store_true', default=False) parser.add_argument('-l', '--libdir', help='Directory where the library.dsc file is located', metavar='DIR') parser.add_argument('target') options = parser.parse_args(args) libdir = options.libdir or '' tree = parse_dsc.LoadProject(os.path.join(libdir, 'library.dsc')) if options.sources: return '\n'.join(GetSources(libdir, tree, options.target)) parser.error('No action specified')
def DoMain(argv): "Entry point for gyp's pymod_do_main command." parser = optparse.OptionParser(usage='%prog: [OPTIONS] TARGET') # Give a clearer error message when this is used as a module. parser.prog = 'dsc_info' parser.add_option('-s', '--sources', help='Print a list of source files for the target', action='store_true', default=False) parser.add_option('-l', '--libdir', help='Directory where the library.dsc file is located', metavar='DIR') options, args = parser.parse_args(argv) if len(args) != 1: parser.error('Expecting exactly one argument.') target = args[0] libdir = options.libdir or '' tree = parse_dsc.LoadProject(os.path.join(libdir, 'library.dsc')) if options.sources: return '\n'.join(GetSources(libdir, tree, target)) parser.error('No action specified')