1
- from pythonforandroid .toolchain import PythonRecipe , shprint , shutil , current_directory
1
+ from pythonforandroid .toolchain import CompiledComponentsPythonRecipe , shprint , shutil , current_directory
2
2
from os .path import join , exists
3
3
import sh
4
4
5
- class PyLevelDBRecipe (PythonRecipe ):
5
+ class PyLevelDBRecipe (CompiledComponentsPythonRecipe ):
6
6
version = '0.193'
7
7
url = 'https://pypi.python.org/packages/source/l/leveldb/leveldb-{version}.tar.gz'
8
8
depends = ['leveldb' , 'hostpython2' , 'python2' , 'setuptools' ]
9
9
patches = ['bindings-only.patch' ]
10
- call_hostpython_via_targetpython = False
10
+ call_hostpython_via_targetpython = False # Due to setuptools
11
11
site_packages_name = 'leveldb'
12
12
13
13
def build_arch (self , arch ):
14
14
env = self .get_recipe_env (arch )
15
15
with current_directory (self .get_build_dir (arch .arch )):
16
16
# Remove source in this pypi package
17
- sh .rm ('-rf' , './ leveldb' , './ leveldb.egg-info' , './ snappy' )
17
+ sh .rm ('-rf' , 'leveldb' , 'leveldb.egg-info' , 'snappy' )
18
18
# Use source from leveldb recipe
19
19
sh .ln ('-s' , self .get_recipe ('leveldb' , self .ctx ).get_build_dir (arch .arch ), 'leveldb' )
20
- # Build python bindings
21
- hostpython = sh .Command (self .hostpython_location )
22
- shprint (hostpython ,
23
- 'setup.py' ,
24
- 'build'
25
- , _env = env )
26
- # Install python bindings
20
+ # Build and install python bindings
27
21
super (PyLevelDBRecipe , self ).build_arch (arch )
28
22
29
23
def get_recipe_env (self , arch ):
@@ -34,8 +28,7 @@ def get_recipe_env(self, arch):
34
28
env ['CFLAGS' ] += ' -I' + env ['PYTHON_ROOT' ] + '/include/python2.7'
35
29
# Set linker to use the correct gcc
36
30
env ['LDSHARED' ] = env ['CC' ] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
37
- env ['LDFLAGS' ] += ' -L' + env ['PYTHON_ROOT' ] + '/lib' + \
38
- ' -lpython2.7' + \
31
+ env ['LDFLAGS' ] += ' -lpython2.7' + \
39
32
' -lleveldb'
40
33
return env
41
34
0 commit comments