예제 #1
0
def remove_spurious_template_configs(target):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))

    found, action, params = yield from vcxproj.skip_to(
        target, "ItemGroup",
        lambda a: a.get("Label") == "ProjectConfigurations")
    assert found
    target.send((action, params))

    while True:
        found, action, params = yield from vcxproj.skip_to(
            target, "ProjectConfiguration",
            lambda a: a.get("Include", "").startswith("Template|"))
        if not found:
            target.send((action, params))  # end_elem ItemGroup
            break
        _, action, params = yield from vcxproj.skip_to(
            None)  # Discard ProjectConfiguration

    # From the remainder, discard any elements with a Condition attribute referencing Template|*.
    while True:
        action, params = yield
        if action == "start_elem" and re.match(
                config_re("Template"), params["attrs"].get("Condition", "")):
            _, action, params = yield from vcxproj.skip_to(None)
            continue
        target.send((action, params))
def remove_spurious_template_configs(target):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))

    found, action, params = yield from vcxproj.skip_to(target, "ItemGroup",
                                                       lambda a: a.get("Label") == "ProjectConfigurations")
    assert found
    target.send((action, params))

    while True:
        found, action, params = yield from vcxproj.skip_to(target, "ProjectConfiguration",
                                                           lambda a: a.get("Include", "").startswith("Template|"))
        if not found:
            target.send((action, params))  # end_elem ItemGroup
            break
        _, action, params = yield from vcxproj.skip_to(None)  # Discard ProjectConfiguration

    # From the remainder, discard any elements with a Condition attribute referencing Template|*.
    while True:
        action, params = yield
        if action == "start_elem" and re.match(config_re("Template"), params["attrs"].get("Condition", "")):
            _, action, params = yield from vcxproj.skip_to(None)
            continue
        target.send((action, params))
def set_platform_toolset(target, toolset="Windows7.1SDK"):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))

    while True:
        found, action, params = yield from vcxproj.skip_to(target, "PropertyGroup",
                                                           lambda a: a.get("Label") == "Configuration")
        target.send((action, params))  # start_elem PropertyGroup or end_elem Project
        if not found:
            break
        action, params = yield from vcxproj.set_content(target, "PlatformToolset", toolset)
        target.send((action, params))  # end_elem PropertyGroup

    while True:
        target.send((yield))
def remove_tag_sub(target, tag_name_and_attr_test_seq):
    tag_name, attr_test = tag_name_and_attr_test_seq[0]
    further_levels = tag_name_and_attr_test_seq[1:]
    while True:
        found, action, params = yield from vcxproj.skip_to(target, tag_name, attr_test)
        if found:
            if further_levels:
                target.send((action, params))
                action, params = yield from remove_tag_sub(target, further_levels)
                assert action == "end_elem"
                assert params["name"] == tag_name
                target.send((action, params))
                continue
            found, action, params = yield from vcxproj.skip_to(None)
            continue
        return action, params
예제 #5
0
def remove_tag_sub(target, tag_name_and_attr_test_seq):
    tag_name, attr_test = tag_name_and_attr_test_seq[0]
    further_levels = tag_name_and_attr_test_seq[1:]
    while True:
        found, action, params = yield from vcxproj.skip_to(
            target, tag_name, attr_test)
        if found:
            if further_levels:
                target.send((action, params))
                action, params = yield from remove_tag_sub(
                    target, further_levels)
                assert action == "end_elem"
                assert params["name"] == tag_name
                target.send((action, params))
                continue
            found, action, params = yield from vcxproj.skip_to(None)
            continue
        return action, params
def remove_tag(target, tag_name_and_attr_test_seq):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))
    action, params = yield from remove_tag_sub(target, tag_name_and_attr_test_seq)
    assert action == "end_elem"
    assert params["name"] == "Project"
    target.send((action, params))
    while True:
        target.send((yield))
예제 #7
0
def set_platform_toolset(target, toolset="Windows7.1SDK"):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))

    while True:
        found, action, params = yield from vcxproj.skip_to(
            target, "PropertyGroup",
            lambda a: a.get("Label") == "Configuration")
        target.send(
            (action, params))  # start_elem PropertyGroup or end_elem Project
        if not found:
            break
        action, params = yield from vcxproj.set_content(
            target, "PlatformToolset", toolset)
        target.send((action, params))  # end_elem PropertyGroup

    while True:
        target.send((yield))
def add_prop_sheet(target, filename):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))

    while True:
        found, action, params = yield from vcxproj.skip_to(target, "ImportGroup",
                                                           lambda a: a.get("Label") == "PropertySheets")
        target.send((action, params))  # start_elem ImportGroup or end_elem Project
        if not found:
            break
        found, action, params = yield from vcxproj.skip_to(target, "Import",
                                                           lambda a: a.get("Project").replace("\\", "/").strip('"') ==
                                                           filename.replace("\\", "/").strip('"'))
        assert not found, "Property sheet " + filename + " already imported"
        vcxproj.send_element(target, "Import", vcxproj.dict(Project=filename))
        target.send((action, params))  # end_elem ImportGroup

    while True:
        target.send((yield))
예제 #9
0
def remove_tag(target, tag_name_and_attr_test_seq):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))
    action, params = yield from remove_tag_sub(target,
                                               tag_name_and_attr_test_seq)
    assert action == "end_elem"
    assert params["name"] == "Project"
    target.send((action, params))
    while True:
        target.send((yield))
예제 #10
0
def add_prop_sheet(target, filename):
    found, action, params = yield from vcxproj.skip_to(target, "Project")
    assert found
    target.send((action, params))

    while True:
        found, action, params = yield from vcxproj.skip_to(
            target, "ImportGroup",
            lambda a: a.get("Label") == "PropertySheets")
        target.send(
            (action, params))  # start_elem ImportGroup or end_elem Project
        if not found:
            break
        found, action, params = yield from vcxproj.skip_to(
            target, "Import", lambda a: a.get("Project").replace("\\", "/").
            strip('"') == filename.replace("\\", "/").strip('"'))
        assert not found, "Property sheet " + filename + " already imported"
        vcxproj.send_element(target, "Import", vcxproj.dict(Project=filename))
        target.send((action, params))  # end_elem ImportGroup

    while True:
        target.send((yield))