Right, I had the problem with the original code:

Reading patch file /home/vtune/git/dp7_xwalk_quick/src/xwalk/patch/patches/v8-profiling.patch
Traceback (most recent call last):
  File "src/xwalk/tools/patcher.py", line 75, in <module>
    patchObj.apply(pdir)
  File "/home/vtune/git/dp7_xwalk_quick/src/xwalk/tools/patch_util.py", line 438, in apply
    if patch_hunks(backupname, filename, self.hunks[fileno]):
  File "/home/vtune/git/dp7_xwalk_quick/src/xwalk/tools/patch_util.py", line 575, in patch_hunks
    mode = os.stat(srcname).ST_MODE
AttributeError: 'posix.stat_result' object has no attribute 'ST_MODE'

There are two options to fix it:
(1) use st_mode instead of ST_MODE
     mode = os.stat(srcname).st_mode
(2) access ST_MODE by index
     mode = os.stat(srcname)[stat.ST_MODE]

Probably the first one looks better.