(argv)
return 0
Main function of this vcproj prettifier.
Main function of this vcproj prettifier.
Main function of this vcproj prettifier .
def main(argv):
    """Main function of this vcproj prettifier."""
    global ARGUMENTS
    ARGUMENTS = argv

    # check if we have exactly 1 parameter.
    if len(argv) < 2:
        print(
            'Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] '
            "[key2=value2]" % argv[0]
        )
        return 1

    # Parse the keys
    for i in range(2, len(argv)):
        (key, value) = argv[i].split("=")
        REPLACEMENTS[key] = value

    # Open the vcproj and parse the xml.
    dom = parse(argv[1])

    # First thing we need to do is find the Configuration Node and merge them
    # with the vsprops they include.
    for configuration_node in GetConfiguationNodes(dom.documentElement):
        # Get the property sheets associated with this configuration.
        vsprops = configuration_node.getAttribute("InheritedPropertySheets")

        # Fix the filenames to be absolute.
        vsprops_list = FixFilenames(
            vsprops.strip().split(";"), os.path.dirname(argv[1])
        )

        # Extend the list of vsprops with all vsprops contained in the current
        # vsprops.
        for current_vsprops in vsprops_list:
            vsprops_list.extend(GetChildrenVsprops(current_vsprops))

        # Now that we have all the vsprops, we need to merge them.
        for current_vsprops in vsprops_list:
            MergeProperties(configuration_node, parse(current_vsprops).documentElement)

    # Now that everything is merged, we need to cleanup the xml.
    CleanupVcproj(dom.documentElement)

    # Finally, we use the prett xml function to print the vcproj back to the
    # user.
    # print dom.toprettyxml(newl="\n")
    PrettyPrintNode(dom.documentElement)
    return 0
def main ( argv ) : global ARGUMENTS ARGUMENTS = argv # check if we have exactly 1 parameter. if len ( argv ) < 2 : print ( 'Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] ' "[key2=value2]" % argv [ 0 ] ) return 1 # Parse the keys for i in range ( 2 , len ( argv ) ) : ( key , value ) = argv [ i ] . split ( "=" ) REPLACEMENTS [ key ] = value # Open the vcproj and parse the xml. dom = parse ( argv [ 1 ] ) # First thing we need to do is find the Configuration Node and merge them # with the vsprops they include. for configuration_node in GetConfiguationNodes ( dom . documentElement ) : # Get the property sheets associated with this configuration. vsprops = configuration_node . getAttribute ( "InheritedPropertySheets" ) # Fix the filenames to be absolute. vsprops_list = FixFilenames ( vsprops . strip ( ) . split ( ";" ) , os . path . dirname ( argv [ 1 ] ) ) # Extend the list of vsprops with all vsprops contained in the current # vsprops. for current_vsprops in vsprops_list : vsprops_list . extend ( GetChildrenVsprops ( current_vsprops ) ) # Now that we have all the vsprops, we need to merge them. for current_vsprops in vsprops_list : MergeProperties ( configuration_node , parse ( current_vsprops ) . documentElement ) # Now that everything is merged, we need to cleanup the xml. CleanupVcproj ( dom . documentElement ) # Finally, we use the prett xml function to print the vcproj back to the # user. # print dom.toprettyxml(newl="\n") PrettyPrintNode ( dom . documentElement ) return 0