1- from pythonforandroid .toolchain import PythonRecipe , shprint , shutil , current_directory
1+ from pythonforandroid .toolchain import CompiledComponentsPythonRecipe , shprint , shutil , current_directory
22from os .path import join , exists
33import sh
44
5- class PyLevelDBRecipe (PythonRecipe ):
5+ class PyLevelDBRecipe (CompiledComponentsPythonRecipe ):
66 version = '0.193'
77 url = 'https://pypi.python.org/packages/source/l/leveldb/leveldb-{version}.tar.gz'
88 depends = ['leveldb' , 'hostpython2' , 'python2' , 'setuptools' ]
99 patches = ['bindings-only.patch' ]
10- call_hostpython_via_targetpython = False
10+ call_hostpython_via_targetpython = False # Due to setuptools
1111 site_packages_name = 'leveldb'
1212
1313 def build_arch (self , arch ):
1414 env = self .get_recipe_env (arch )
1515 with current_directory (self .get_build_dir (arch .arch )):
1616 # Remove source in this pypi package
17- sh .rm ('-rf' , './ leveldb' , './ leveldb.egg-info' , './ snappy' )
17+ sh .rm ('-rf' , 'leveldb' , 'leveldb.egg-info' , 'snappy' )
1818 # Use source from leveldb recipe
1919 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
2721 super (PyLevelDBRecipe , self ).build_arch (arch )
2822
2923 def get_recipe_env (self , arch ):
@@ -34,8 +28,7 @@ def get_recipe_env(self, arch):
3428 env ['CFLAGS' ] += ' -I' + env ['PYTHON_ROOT' ] + '/include/python2.7'
3529 # Set linker to use the correct gcc
3630 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' + \
3932 ' -lleveldb'
4033 return env
4134
0 commit comments