Closed jayvdb closed 4 years ago
Indeed, Windows support is shoddy.
However, instead of trying to crossport patch
, whatthepatch does do some rudimentary patch application itself (1:1 applications without any fuzzy matching on the hunks). While the /tmp stuff is a boneheaded move and can change, it's only needed in order to support the patch
implementation. It seems that mutmut would also benefit from disabling the use of patch all together, which is the default: def apply_diff(diff, text, reverse=False, use_patch=False):
. It's not ideal (we could be checking for patch and automatically attempting ourselves), but this is one potential workaround.
Oh, cool, Travis CI now has Windows. Will be adding that as part of any fixes. Thanks
Windows CI is sorely needed.
whatthepatch/apply.py creates files named
/tmp/wtp-*
and uses thepatch
binary.The former is not portable to Windows, and the
patch
binary on Windows can come from a variety of sources with quite different logic inside wrt line endings, etc, so unless there is Windows CI ensuring compatibility with various Windows patch provides it is fair to assume it isnt supported.https://www.google.com/search?q=gnu+patch+MS+windows first result is http://gnuwin32.sourceforge.net/packages/patch.htm , which is probably not going to work. I remember getting quilt to work with it was painful. https://chocolatey.org/packages/patch says it is also the gnuwin32 patch.exe. It may have improved since then, but I wouldnt expect it works out of the box.
Searching for "patch.exe" leads me to https://www.file.net/process/patch.exe.html as result 1 and https://www.processlibrary.com/en/directory/files/patch/29693/ for result 3 .. , wow.
It might be worth trying to levarage one of the supported VCS to help find/invoke the correct
patch
. It would be reasonable to require that Windows install "Git BASH" from https://gitforwindows.org/ . tortoisemerge, tortoisesvn and tortoisegit also include apatch.exe
iirc.Unless there is a high priority on fixing Windows support, a note in the README indicating Windows isnt supported would be a good idea for the interim so users of the library know which parts are Unix-only, which can also led to people helping with the effort to fix the problems.