diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7972a2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +__pycache__ +*.pyc +*.pyo +./*.egg-info +./build +./dist +./.eggs diff --git a/patch.py b/patch.py index 4b82af0..e160b6d 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 = " + str(p.source, encoding="utf-8")) + debug(" target = " + str(p.target, encoding="utf-8")) if p.type in (HG, GIT): # TODO: figure out how to deal with /dev/null entries debug("stripping a/ and b/ prefixes") @@ -892,6 +892,7 @@ def apply(self, strip=0, root=None): if line.rstrip(b"\r\n") == hunkfind[hunklineno]: hunklineno+=1 else: + errors += 1 info("file %d/%d:\t %s" % (i+1, total, filename)) info(" hunk no.%d doesn't match source file at line %d" % (hunkno+1, lineno+1)) info(" expected: %s" % hunkfind[hunklineno]) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..530bed1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,14 @@ +[metadata] +name = patch +version = 1.16 +author = anatoly techtonik +license = MIT +description = Patch utility to apply unified diffs +url = https://github.com/techtonik/python-patch/ +classifiers = + Classifier: Programming Language :: Python :: 2 + Classifier: Programming Language :: Python :: 3 + +[options] +py_modules = patch +setup_requires = setuptools; setuptools_scm diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d808dd6 --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 +from setuptools import setup +if __name__ == "__main__": + setup(use_scm_version = True)