Creating patches for Conda recipes - dstronczek/ilastik_py3win GitHub Wiki
Creating a patch file for conda recipes
Sometimes you need to make changes to the code or the CMakeFiles of a project, in order for it to compile/build successfully on your system. This may be due to bugs in the code, or due to specific differences on certain operating systems, often if the software was only developed and tested on one operating system. Some changes may also be necessary to convert python 2.7 code to python 3, or the other way around. Conda offers a patch-functionality, which applies changes to the code after downloading, but before the actual build process is started.
0. Prerequisites
In addition to conda and conda-build, you'll need git
installed on your system (you can install git with the command conda install git
).
1. Creating the patch file
To create the patch file, you first need to clone the git repository somewhere on your hard drive, using git clone http://your.git.repository
.
Then switch to the version of the code that will be used in the recipe by using either git checkout tags/YOUR_TAG
or git checkout HASH_OF_YOUR_COMMIT
.
Now, apply all the changes you want to make to the files in the repository.
The patch file can then be created with the command git diff -p > NAME_OF_YOUR_PATCH.FILE
in the root directory.
Tip: If you're working on Windows, check whether the patch file uses the correct end-of-line-style. On Windows the standard is carriage return + new line (\r\n), but git may create files with Unix line breaks (\n). Sometimes that can interrupt the build process, as the patching tool crashes. To change the end-of-line-style, use an editor, like Notepad++.
2. Including the patch file in the recipe
The file you created in the last step was created in the repositories main folder and needs to be moved or copied to the conda recipe folder.
Then you need to add the patch to the meta.yaml file under source/patches
.
You can then run the build normally.