Skip to content

Fixes pyleveldb recipe #1699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class TargetPython(Enum):
'protobuf_cpp',
'xeddsa',
'x3dh',
# fatal error: crypt.h: No such file or directory
'pyleveldb',
'pynacl',
'doubleratchet',
# The opencv recipe fails to pass travis tests due to the long processing
Expand Down Expand Up @@ -85,8 +83,6 @@ class TargetPython(Enum):
'opencv',
# requires `libpq-dev` system dependency e.g. for `pg_config` binary
'psycopg2',
# fatal error: crypt.h: No such file or directory
'pyleveldb',
'protobuf_cpp',
# most likely some setup in the Docker container, because it works in host
'pyjnius', 'pyopenal',
Expand Down
24 changes: 2 additions & 22 deletions pythonforandroid/recipes/pyleveldb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.toolchain import current_directory
import sh
from pythonforandroid.recipe import CppCompiledComponentsPythonRecipe


class PyLevelDBRecipe(CompiledComponentsPythonRecipe):
class PyLevelDBRecipe(CppCompiledComponentsPythonRecipe):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a side note: That is my biggest concern, because we make dependant of gnustl_shared (which, as far as I know, is Deprecated in ndk r18)...so all recipes that depend on gnustl_shared will fail with newer ndks...but ,we have all relevant code concentrated in CppCompiledComponentsPythonRecipe 😉

Related to: Support for NDK 19 (#1613)
See also: https://developer.android.com/ndk/guides/cpp-support

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know!

version = '0.193'
url = 'https://pypi.python.org/packages/source/l/leveldb/leveldb-{version}.tar.gz'
depends = ['snappy', 'leveldb', ('hostpython2', 'hostpython3'), 'setuptools']
patches = ['bindings-only.patch']
call_hostpython_via_targetpython = False # Due to setuptools
site_packages_name = 'leveldb'

def build_arch(self, arch):
with current_directory(self.get_build_dir(arch.arch)):
# Remove source in this pypi package
sh.rm('-rf', 'leveldb', 'leveldb.egg-info', 'snappy')
# Use source from leveldb recipe
sh.ln('-s', self.get_recipe('leveldb', self.ctx).get_build_dir(arch.arch), 'leveldb')
# Build and install python bindings
super(PyLevelDBRecipe, self).build_arch(arch)

def get_recipe_env(self, arch):
env = super(PyLevelDBRecipe, self).get_recipe_env(arch)
# Copy environment from leveldb recipe
env.update(self.get_recipe('leveldb', self.ctx).get_recipe_env(arch))
# Set linker to use the correct gcc
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
env['LDFLAGS'] += ' -lleveldb'
return env


recipe = PyLevelDBRecipe()