code: def apply_patches(self, arch, build_dir=None):
          '''Apply any patches for the Recipe.
  
          .. versionchanged:: 0.6.0
              Add ability to apply patches from any dir via kwarg `build_dir`'''
          if self.patches:
              info_main('Applying patches for {}[{}]'
                        .format(self.name, arch.arch))
  
              if self.is_patched(arch):
                  info_main('{} already patched, skipping'.format(self.name))
                  return
  
              build_dir = build_dir if build_dir else self.get_build_dir(arch.arch)
              for patch in self.patches:
                  if isinstance(patch, (tuple, list)):
                      patch, patch_check = patch
                      if not patch_check(arch=arch, recipe=self):
                          continue
  
                  self.apply_patch(
                          patch.format(version=self.version, arch=arch.arch),
                          arch.arch, build_dir=build_dir)
  
              shprint(sh.touch, join(build_dir, '.patched')f apply_patches(self, arch, build_dir=None):
          '''Apply any patches for the Recipe.
  
          .. versionchanged:: 0.6.0
              Add ability to apply patches from any dir via kwarg `build_dir`'''
          if self.patches:
              info_main('Applying patches for {}[{}]'
                        .format(self.name, arch.arch))
  
              if self.is_patched(arch):
                  info_main('{} already patched, skipping'.format(self.name))
                  return
  
              build_dir = build_dir if build_dir else self.get_build_dir(arch.arch)
              for patch in self.patches:
                  if isinstance(patch, (tuple, list)):
                      patch, patch_check = patch
                      if not patch_check(arch=arch, recipe=self):
                          continue
  
                  self.apply_patch(
                          patch.format(version=self.version, arch=arch.arch),
                          arch.arch, build_dir=build_dir)
  
              shprint(sh.touch, join(build_dir, '.patched'))
docs: Apply any patches for the Recipe.
  
          .. versionchanged:: 0.6.0
              Add ability to apply patches from any dir via kwarg `build_dir`