vcxproj-stream-editor


Namevcxproj-stream-editor JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryRewrite Visual Studio .vcxproj files without spurious changes
upload_time2024-07-07 19:23:25
maintainerNone
docs_urlNone
authorMark A. Tsuchida, contributors
requires_python>=3.3
licenseNone
keywords visual studio msbuild vcxproj project xml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # vcxproj-stream-editor
Simple Python library to parse Microsoft Visual Studio .vcxproj files and modify/rewrite without spurious changes

## Usage:

Given the following simplified `myproject.vcxproj`:
``` xml
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="Globals">
    <ProjectGuid>{96F21549-A7BF-4695-A1B1-B43625B91A14}</ProjectGuid>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
    </ClCompile>
  </ItemDefinitionGroup>
</Project>
```

### Example 1 (input only):
``` python
import vcxproj

@vcxproj.coroutine
def print_project_guid():
    while True:
        action, params = yield
        if action == "start_elem" and params["name"] == "ProjectGuid":
            action, params = yield
            assert action == "chars"
            print("Project GUID is ", params["content"])

vcxproj.check_file("myproject.vcxproj", print_project_guid)
```
Output:
```
Project GUID is {96F21549-A7BF-4695-A1B1-B43625B91A14}
```

### Example 2 (input and output):
``` python
import vcxproj

@vcxproj.coroutine
def remove_warning_level(target)
    while True:
        action, params = yield
        if action == "start_elem" and params["name"] == "WarningLevel":
            action, params = yield
            assert action == "chars"
            action, params = yield
            assert action == "end_elem"
            assert params["name"] == "WarningLevel"
            continue
        target.send((action, params))
        
vcxproj.filter_file("myproject.vcxproj", remove_warning_level, "myproject.stripped.vcxproj")
```

`myproject.stripped.vcxproj` will have the following content:
``` xml
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="Globals">
    <ProjectGuid>{96F21549-A7BF-4695-A1B1-B43625B91A14}</ProjectGuid>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
    </ClCompile>
  </ItemDefinitionGroup>
</Project>
```

### Possible values for `(action, params)`:
| action       | params                                                               |
|--------------|----------------------------------------------------------------------|
| `start_elem` | `{"name":<elem_name>, "attrs":{<attr1>:<value1>, <attr2>:<value2>}}` |
| `chars`      | `{"content":<content>}`                                              |
| `end_elem`   | `{"name":<elem_name>}`                                               |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "vcxproj-stream-editor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.3",
    "maintainer_email": null,
    "keywords": "Visual Studio, MSBuild, vcxproj, project, XML",
    "author": "Mark A. Tsuchida, contributors",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/96/25/a0d978d6b34cced23ba0e6d84f9503f3956d838661ba22d328c507ef76ca/vcxproj_stream_editor-0.1.0.tar.gz",
    "platform": null,
    "description": "# vcxproj-stream-editor\nSimple Python library to parse Microsoft Visual Studio .vcxproj files and modify/rewrite without spurious changes\n\n## Usage:\n\nGiven the following simplified `myproject.vcxproj`:\n``` xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{96F21549-A7BF-4695-A1B1-B43625B91A14}</ProjectGuid>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n    </ClCompile>\n  </ItemDefinitionGroup>\n</Project>\n```\n\n### Example 1 (input only):\n``` python\nimport vcxproj\n\n@vcxproj.coroutine\ndef print_project_guid():\n    while True:\n        action, params = yield\n        if action == \"start_elem\" and params[\"name\"] == \"ProjectGuid\":\n            action, params = yield\n            assert action == \"chars\"\n            print(\"Project GUID is \", params[\"content\"])\n\nvcxproj.check_file(\"myproject.vcxproj\", print_project_guid)\n```\nOutput:\n```\nProject GUID is {96F21549-A7BF-4695-A1B1-B43625B91A14}\n```\n\n### Example 2 (input and output):\n``` python\nimport vcxproj\n\n@vcxproj.coroutine\ndef remove_warning_level(target)\n    while True:\n        action, params = yield\n        if action == \"start_elem\" and params[\"name\"] == \"WarningLevel\":\n            action, params = yield\n            assert action == \"chars\"\n            action, params = yield\n            assert action == \"end_elem\"\n            assert params[\"name\"] == \"WarningLevel\"\n            continue\n        target.send((action, params))\n        \nvcxproj.filter_file(\"myproject.vcxproj\", remove_warning_level, \"myproject.stripped.vcxproj\")\n```\n\n`myproject.stripped.vcxproj` will have the following content:\n``` xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{96F21549-A7BF-4695-A1B1-B43625B91A14}</ProjectGuid>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n    </ClCompile>\n  </ItemDefinitionGroup>\n</Project>\n```\n\n### Possible values for `(action, params)`:\n| action       | params                                                               |\n|--------------|----------------------------------------------------------------------|\n| `start_elem` | `{\"name\":<elem_name>, \"attrs\":{<attr1>:<value1>, <attr2>:<value2>}}` |\n| `chars`      | `{\"content\":<content>}`                                              |\n| `end_elem`   | `{\"name\":<elem_name>}`                                               |\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Rewrite Visual Studio .vcxproj files without spurious changes",
    "version": "0.1.0",
    "project_urls": {
        "Repository": "https://github.com/marktsuchida/vcxproj-stream-editor"
    },
    "split_keywords": [
        "visual studio",
        " msbuild",
        " vcxproj",
        " project",
        " xml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb4309b1ad059c17b17b3e9da43bd311f03e915efe8a8693e2fa8eceaf1db891",
                "md5": "8ca7ef82a2b01f16a65a44e23bd66a1e",
                "sha256": "fb386c02534e0eb46c04abba3af33a78b4428b07afb0e4d95219c21199f4ef93"
            },
            "downloads": -1,
            "filename": "vcxproj_stream_editor-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ca7ef82a2b01f16a65a44e23bd66a1e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.3",
            "size": 7384,
            "upload_time": "2024-07-07T19:23:21",
            "upload_time_iso_8601": "2024-07-07T19:23:21.727078Z",
            "url": "https://files.pythonhosted.org/packages/eb/43/09b1ad059c17b17b3e9da43bd311f03e915efe8a8693e2fa8eceaf1db891/vcxproj_stream_editor-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9625a0d978d6b34cced23ba0e6d84f9503f3956d838661ba22d328c507ef76ca",
                "md5": "6579869cf5ded83d581ef980758d0928",
                "sha256": "545da0f021c93666ba0b96590aad9f39772985a51957c3b48c8646daa307c411"
            },
            "downloads": -1,
            "filename": "vcxproj_stream_editor-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6579869cf5ded83d581ef980758d0928",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.3",
            "size": 7471,
            "upload_time": "2024-07-07T19:23:25",
            "upload_time_iso_8601": "2024-07-07T19:23:25.449400Z",
            "url": "https://files.pythonhosted.org/packages/96/25/a0d978d6b34cced23ba0e6d84f9503f3956d838661ba22d328c507ef76ca/vcxproj_stream_editor-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-07 19:23:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "marktsuchida",
    "github_project": "vcxproj-stream-editor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "vcxproj-stream-editor"
}
        
Elapsed time: 0.37754s