Skip to content

Commit 013a23e

Browse files
author
Pol Canelles
committed
Fixes the m2crypto's recipe
1 parent ed36e8d commit 013a23e

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

pythonforandroid/recipes/m2crypto/__init__.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
1-
from pythonforandroid.toolchain import PythonRecipe, shprint, shutil, current_directory
2-
from os.path import join, exists
1+
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, current_directory
2+
from pythonforandroid.logger import shprint, info
3+
import glob
34
import sh
45

5-
class M2CryptoRecipe(PythonRecipe):
6+
class M2CryptoRecipe(CompiledComponentsPythonRecipe):
67
version = '0.24.0'
78
url = 'https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-{version}.tar.gz'
8-
#md5sum = '89557730e245294a6cab06de8ad4fb42'
9+
# md5sum = '89557730e245294a6cab06de8ad4fb42'
910
depends = ['openssl', 'hostpython2', 'python2', 'setuptools']
1011
site_packages_name = 'M2Crypto'
1112
call_hostpython_via_targetpython = False
1213

13-
def build_arch(self, arch):
14+
def build_compiled_components(self, arch):
15+
info('Building compiled components in {}'.format(self.name))
16+
1417
env = self.get_recipe_env(arch)
1518
with current_directory(self.get_build_dir(arch.arch)):
16-
# Build M2Crypto
1719
hostpython = sh.Command(self.hostpython_location)
18-
shprint(hostpython,
19-
'setup.py',
20-
'build_ext',
20+
if self.install_in_hostpython:
21+
shprint(hostpython, 'setup.py', 'clean', '--all', _env=env)
22+
shprint(hostpython, 'setup.py', self.build_cmd,
2123
'-p' + arch.arch,
2224
'-c' + 'unix',
2325
'-o' + env['OPENSSL_BUILD_PATH'],
24-
'-L' + env['OPENSSL_BUILD_PATH']
25-
, _env=env)
26-
# Install M2Crypto
27-
super(M2CryptoRecipe, self).build_arch(arch)
26+
'-L' + env['OPENSSL_BUILD_PATH'],
27+
_env=env, *self.setup_extra_args)
28+
build_dir = glob.glob('build/lib.*')[0]
29+
shprint(sh.find, build_dir, '-name', '"*.o"', '-exec',
30+
env['STRIP'], '{}', ';', _env=env)
2831

2932
def get_recipe_env(self, arch):
3033
env = super(M2CryptoRecipe, self).get_recipe_env(arch)

0 commit comments

Comments
 (0)