Package: pypatch
Automatically apply patches to third-party libraries as part of your build.Now and again, a specific fix is needed for a python package that isn’t available from the vendor/community.
This project was created to allow a way for us to patch specific python modules during the build process.PyPatch is a command wrapper based around Anatoly Techtonik’s patch.py utility. PyPatch allows you to patch python
libraries using a unified diff file. Specifically, PyPatch is meant to be used in automatic build processes where you
have a 3rd party library that needs to be patched when being deployed. Instead of maintaining your own separate version
of the library, you can just issue your patch during the build process.Usagepypatch apply [libarary.package] custom_diff.patchAs a part of the work flow:c:\project\pipinstall djangoc:\project\pipinstall pypatchc:\project\pypatchapply django.contrib.authc:\project\patches\my_auth_fix.patchHow it worksPyPatch applies patches to files relative to the root directory of the named package. So it does have to be installed into the target environment.For example, if the django package was installed to “C:Python27Libsite-packagesdjango” and you needed to patch the auth contrib package (django.contrib.auth), your command might look likepypatch apply django.contrib.authc:\project\patches\my_auth_fix.patch"and the files named in my_auth_fix.patch would use relative pathing from the package directory:---models.py2013-05-0615:12:14.212220100-0700+++ models.py2013-05-0614:36:20.535220100-0700If you used`pypatch apply django.contribc:\project\patches\my_auth_fix.patch`instead, your diff patch would read---auth/models.py2013-05-0615:12:14.212220100-0700+++ auth/models.py2013-05-0614:36:20.535220100-0700BuildTo build the distributable python package, run ‘sdist’ from the Project Root Directory.
Recommended: setting the output directory to our Libraries foldersdist--dist-dir="C:\outputdir"This will build the zipped python package that can be installed via pip or easy_installOtherInformation on the Unified Diff format can be found athttps://www.gnu.org/software/diffutils/manual/html_node/Unified-Format.html#Unified-FormatThe MIT License (MIT)Copyright (c) 2013 sitkatechPermission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.