| Total Complexity | 2 | 
| Total Lines | 18 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | from SCons.Script import *  | 
            ||
| 2 | import os  | 
            ||
| 3 | |||
| 4 | def patch(target, source, env):  | 
            ||
| 5 | '''  | 
            ||
| 6 | The first file in the source list is the patch file,  | 
            ||
| 7 | then comes the file to be patched.  | 
            ||
| 8 | The target argument contains the file to be created.  | 
            ||
| 9 | '''  | 
            ||
| 10 | patch_file = str(source[0])  | 
            ||
| 11 |     assert(patch_file.endswith('.patch')) | 
            ||
| 12 | orig_file = str(source[1])  | 
            ||
| 13 | target_file = str(target[0])  | 
            ||
| 14 | print "Patching third party code ..."  | 
            ||
| 15 |     os.system("patch -o %s %s %s"%(target_file, orig_file, patch_file)) | 
            ||
| 16 | |||
| 17 | patchbuilder = Builder(action = patch)  | 
            ||
| 18 |