From 4ad6fbc2252c563b6a8e646543bb0480df9c7bfd Mon Sep 17 00:00:00 2001 From: liangyingy <46518962+liangyingy@users.noreply.github.com> Date: Mon, 7 Nov 2022 11:29:35 +0800 Subject: [PATCH 1/2] fix: String handling error --- patch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patch.py b/patch.py index 4775d70..c0975e9 100755 --- a/patch.py +++ b/patch.py @@ -697,8 +697,8 @@ def _normalize_filenames(self): for i,p in enumerate(self.items): if debugmode: debug(" patch type = " + p.type) - debug(" source = " + p.source) - debug(" target = " + p.target) + debug(" source = " + p.source.decode()) + debug(" target = " + p.target.decode()) if p.type in (HG, GIT): # TODO: figure out how to deal with /dev/null entries debug("stripping a/ and b/ prefixes") @@ -1200,4 +1200,4 @@ def main(): # PatchSet.items --> PatchSet.patches # [ ] run --revert test for all dataset items -# [ ] run .parse() / .dump() test for dataset +# [ ] run .parse() / .dump() test for dataset \ No newline at end of file From c16301e4b170ce69ed1319c6a4dd6b8e82e73ede Mon Sep 17 00:00:00 2001 From: liangyingy <1102390310@qq.com> Date: Mon, 7 Nov 2022 13:40:08 +0800 Subject: [PATCH 2/2] add setup.py Signed-off-by: liangyingy <1102390310@qq.com> --- .gitignore | 4 ++++ setup.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .gitignore create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93cb941 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__ +build +dist +python_patch.egg-info \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..36771c8 --- /dev/null +++ b/setup.py @@ -0,0 +1,28 @@ +import pathlib + +from setuptools import setup, find_packages + +import patch + +setup( + name="python-patch", + version=patch.__version__, + description="Library to parse and apply unified diffs.", + long_description=(pathlib.Path(__file__).parent / "README.md").read_text(), + long_description_content_type="text/markdown", + url=patch.__url__, + author=patch.__author__, + author_email="techtonik@gmail.com", + license=patch.__license__, + entry_points={"console_scripts": ["patch.py=patch:main"]}, + # packages=find_packages(exclude=["tests", "tests.*"]), + packages = ["."], + install_requires=[ + ], + extras_require={ + # [all] pulls in all radio libraries + "testing": [ + "pytest>=5.4.5", + ], + }, +) \ No newline at end of file