forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
65 lines (49 loc) · 2.23 KB
/
__init__.py
File metadata and controls
65 lines (49 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from pythonforandroid.recipe import Recipe, CompiledComponentsPythonRecipe
from os.path import exists, join
from os import uname
class LXMLRecipe(CompiledComponentsPythonRecipe):
version = '4.8.0'
url = 'https://pypi.python.org/packages/source/l/lxml/lxml-{version}.tar.gz' # noqa
depends = ['librt', 'libxml2', 'libxslt', 'setuptools']
name = 'lxml'
call_hostpython_via_targetpython = False # Due to setuptools
def should_build(self, arch):
super().should_build(arch)
py_ver = self.ctx.python_recipe.major_minor_version_string
build_platform = "{system}-{machine}".format(
system=uname()[0], machine=uname()[-1]
).lower()
build_dir = join(
self.get_build_dir(arch.arch),
"build",
"lib." + build_platform + "-" + py_ver,
"lxml",
)
py_libs = ["_elementpath.so", "builder.so", "etree.so", "objectify.so"]
return not all([exists(join(build_dir, lib)) for lib in py_libs])
def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
# libxslt flags
libxslt_recipe = Recipe.get_recipe('libxslt', self.ctx)
libxslt_build_dir = libxslt_recipe.get_build_dir(arch.arch)
# libxml2 flags
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
libxml2_build_dir = libxml2_recipe.get_build_dir(arch.arch)
env["STATIC"] = "true"
env["LXML_STATIC_INCLUDE_DIRS"] = "{}:{}".format(
join(libxml2_build_dir, "include"), join(libxslt_build_dir)
)
env["LXML_STATIC_LIBRARY_DIRS"] = "{}:{}:{}".format(
join(libxml2_build_dir, ".libs"),
join(libxslt_build_dir, "libxslt", ".libs"),
join(libxslt_build_dir, "libexslt", ".libs"),
)
env["WITH_XML2_CONFIG"] = join(libxml2_build_dir, "xml2-config")
env["WITH_XSLT_CONFIG"] = join(libxslt_build_dir, "xslt-config")
env["LXML_STATIC_BINARIES"] = "{}:{}:{}".format(
join(libxml2_build_dir, ".libs", "libxml2.a"),
join(libxslt_build_dir, "libxslt", ".libs", "libxslt.a"),
join(libxslt_build_dir, "libexslt", ".libs", "libexslt.a"),
)
return env
recipe = LXMLRecipe()