|
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 |
3 | 4 | import sh
|
4 | 5 |
|
5 |
| -class M2CryptoRecipe(PythonRecipe): |
| 6 | +class M2CryptoRecipe(CompiledComponentsPythonRecipe): |
6 | 7 | version = '0.24.0'
|
7 | 8 | url = 'https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-{version}.tar.gz'
|
8 |
| - #md5sum = '89557730e245294a6cab06de8ad4fb42' |
| 9 | + # md5sum = '89557730e245294a6cab06de8ad4fb42' |
9 | 10 | depends = ['openssl', 'hostpython2', 'python2', 'setuptools']
|
10 | 11 | site_packages_name = 'M2Crypto'
|
11 | 12 | call_hostpython_via_targetpython = False
|
12 | 13 |
|
13 |
| - def build_arch(self, arch): |
| 14 | + def build_compiled_components(self, arch): |
| 15 | + info('Building compiled components in {}'.format(self.name)) |
| 16 | + |
14 | 17 | env = self.get_recipe_env(arch)
|
15 | 18 | with current_directory(self.get_build_dir(arch.arch)):
|
16 |
| - # Build M2Crypto |
17 | 19 | 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, |
21 | 23 | '-p' + arch.arch,
|
22 | 24 | '-c' + 'unix',
|
23 | 25 | '-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) |
28 | 31 |
|
29 | 32 | def get_recipe_env(self, arch):
|
30 | 33 | env = super(M2CryptoRecipe, self).get_recipe_env(arch)
|
|
0 commit comments