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): class PycryptoRecipe(CythonRecipe):
version = "2.6.1" version = "2.6.1"
url = "https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-{version}.tar.gz" url = "https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-{version}.tar.gz"
#url = 'src'
depends = ["python", "openssl"] depends = ["python", "openssl"]
#cythonize = False
include_per_arch = True include_per_arch = True
library="libpycrypto.a" library="libpycrypto.a"
#pre_build_ext = True
def build_arch(self, arch): def build_arch(self, arch):
@ -30,12 +27,8 @@ class PycryptoRecipe(CythonRecipe):
"--host={}".format(arch), "--host={}".format(arch),
"ac_cv_func_malloc_0_nonnull=yes", "ac_cv_func_malloc_0_nonnull=yes",
"ac_cv_func_realloc_0_nonnull=yes", "ac_cv_func_realloc_0_nonnull=yes",
#"enable-static=yes",
#"enable-shared=no"
) )
hostpython = sh.Command(self.ctx.hostpython) hostpython = sh.Command(self.ctx.hostpython)
#shprint(hostpython, "setup.py", "build_ext", "--inplace", "-v",
# _env=build_env)
super(PycryptoRecipe, self).build_arch(arch) super(PycryptoRecipe, self).build_arch(arch)
def install(self): def install(self):
@ -48,9 +41,7 @@ class PycryptoRecipe(CythonRecipe):
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
shprint(hostpython, "-m", "easy_install", shprint(hostpython, "-m", "easy_install",
"--prefix", dest_dir, "-Z", "./", "--prefix", dest_dir, "-Z", "./",
_env=build_env) _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() recipe = PycryptoRecipe()

View file

@ -424,14 +424,15 @@ class Recipe(object):
print("Unrecognized extension for {}".format(filename)) print("Unrecognized extension for {}".format(filename))
raise Exception() 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 Apply a patch from the current recipe directory into the current
build directory. build directory.
""" """
target_dir = target_dir or self.build_dir
print("Apply patch {}".format(filename)) print("Apply patch {}".format(filename))
filename = join(self.recipe_dir, 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): def copy_file(self, filename, dest):
print("Copy {} to {}".format(filename, dest)) print("Copy {} to {}".format(filename, dest))