include target_dir option to apply_patch` method

This commit is contained in:
akshayaurora 2015-07-18 00:00:22 +05:30
parent 70d2b43e2a
commit 0985301591
2 changed files with 5 additions and 13 deletions

View file

@ -9,12 +9,9 @@ import os
class PycryptoRecipe(CythonRecipe):
version = "2.6.1"
url = "https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-{version}.tar.gz"
#url = 'src'
depends = ["python", "openssl"]
#cythonize = False
include_per_arch = True
library="libpycrypto.a"
#pre_build_ext = True
def build_arch(self, arch):
@ -30,12 +27,8 @@ class PycryptoRecipe(CythonRecipe):
"--host={}".format(arch),
"ac_cv_func_malloc_0_nonnull=yes",
"ac_cv_func_realloc_0_nonnull=yes",
#"enable-static=yes",
#"enable-shared=no"
)
hostpython = sh.Command(self.ctx.hostpython)
#shprint(hostpython, "setup.py", "build_ext", "--inplace", "-v",
# _env=build_env)
super(PycryptoRecipe, self).build_arch(arch)
def install(self):
@ -49,8 +42,6 @@ class PycryptoRecipe(CythonRecipe):
shprint(hostpython, "-m", "easy_install",
"--prefix", dest_dir, "-Z", "./",
_env=build_env)
#print('installing to {}').format(dest_dir)
#shprint(hostpython, "setup.py", "install", "--home={}".format(dest_dir + '/lib/python2.7'), _env=build_env)
#shprint(hostpython, "-m", "pip", "install", "--root", dest_dir, "./")
recipe = PycryptoRecipe()

View file

@ -424,14 +424,15 @@ class Recipe(object):
print("Unrecognized extension for {}".format(filename))
raise Exception()
def apply_patch(self, filename):
def apply_patch(self, filename, target_dir=''):
"""
Apply a patch from the current recipe directory into the current
build directory.
"""
target_dir = target_dir or self.build_dir
print("Apply patch {}".format(filename))
filename = join(self.recipe_dir, filename)
sh.patch("-t", "-d", self.build_dir, "-p1", "-i", filename)
sh.patch("-t", "-d", target_dir, "-p1", "-i", filename)
def copy_file(self, filename, dest):
print("Copy {} to {}".format(filename, dest))