Passed
Push — master ( ab513a...1713a6 )
by Peter
05:21 queued 03:17
created

patch_builder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2
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