Skip to content

Commit c4b8969

Browse files
committed
lxml,libxslt,libxml2,beautifulsoup4 recipe added
1 parent 99599aa commit c4b8969

File tree

6 files changed

+97
-15
lines changed

6 files changed

+97
-15
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
from pythonforandroid.toolchain import (PythonRecipe, shprint,
3+
current_directory, info, Recipe)
4+
from pythonforandroid.patching import will_build, check_any
5+
import sh
6+
from os.path import join
7+
8+
class BSoup4Recipe(PythonRecipe):
9+
version = '4.1.0'
10+
url = 'https://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/beautifulsoup4-{version}.tar.gz'
11+
depends = [('python2', 'python3crystax'), 'lxml']
12+
site_packages_name = 'beautifulsoup4'
13+
call_hostpython_via_targetpython = True
14+
def get_recipe_env(self, arch):
15+
env = super(BSoup4Recipe, self).get_recipe_env(arch)
16+
17+
18+
lxml_recipe = Recipe.get_recipe('lxml', self.ctx)
19+
20+
env['CC'] = env['CC'] + ' -I{lxml_dir}/include -I{lxml_dir}'.format(
21+
lxml_dir=lxml_recipe.get_build_dir(arch))
22+
23+
env['LDFLAGS'] = ('-Llxml_dir/lxml/.libs -Llxml_dir/lxml/.libs ').format(lxml_dir=lxml_recipe.get_build_dir(arch))
24+
25+
recipe = BSoup4Recipe()

pythonforandroid/recipes/libxml2/__init__.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,18 @@
55
from os.path import join
66

77

8-
class Libxml2Recipe(CythonRecipe):
9-
version = '2.9.4'
8+
class Libxml2Recipe(Recipe):
9+
version = '2.9.3'
1010
url = 'ftp://xmlsoft.org/libxml2/libxml2-{version}.tar.gz'
1111
name = 'libxml2'
1212
depends = [('python2', 'python3crystax')]
1313

1414
def get_recipe_env(self, arch):
1515
env = super(Libxml2Recipe, self).get_recipe_env(arch)
1616

17-
try:
18-
sh.sed('runtest\$(EXEEXT) \\/ \\/', 'Makefile')
19-
except:
20-
pass
21-
try:
22-
sh.sed('testrecurse\$(EXEEXT)$//', 'Makefile')
23-
except:
24-
pass
25-
try:
26-
sh.make('-j', '$MAKE_JOBS')
27-
except:
28-
pass
17+
sh.sed('runtest$(EXEEXT) \/ \/', 'Makefile')
18+
sh.sed('testrecurse$(EXEEXT)$//', 'Makefile')
19+
sh.make('-j', '5')
2920

3021

3122
recipe = Libxml2Recipe()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from pythonforandroid.toolchain import (CythonRecipe, shprint,
2+
current_directory, info, Recipe)
3+
from pythonforandroid.patching import will_build, check_any
4+
import sh
5+
from os.path import exists,join
6+
7+
class LibxsltRecipe(CythonRecipe):
8+
version = '1.1.29'
9+
url = 'ftp://xmlsoft.org/libxslt/libxslt-{version}.tar.gz'
10+
name = 'libxslt'
11+
depends = [('python2', 'python3crystax'), 'libxml2']
12+
patches = ['fix-dlopen.patch']
13+
14+
def should_build(self, arch):
15+
return not exists(join(self.get_build_container_dir(arch.arch),"libxslt/.libs/libxslt.a"))
16+
17+
18+
def get_recipe_env(self, arch):
19+
env = super(LibxsltRecipe, self).get_recipe_env(arch)
20+
sh.make('-j', '5')
21+
22+
23+
recipe = LibxsltRecipe()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- libxslt-1.1.27.orig/python/libxsl.py 2012-09-04 16:26:23.000000000 +0200
2+
+++ libxslt-1.1.27/python/libxsl.py 2013-07-29 15:11:04.182227378 +0200
3+
@@ -4,7 +4,7 @@
4+
# loader to work in that mode if feasible
5+
#
6+
import sys
7+
-if not hasattr(sys,'getdlopenflags'):
8+
+if True:
9+
import libxml2mod
10+
import libxsltmod
11+
import libxml2
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
3+
from pythonforandroid.toolchain import (CythonRecipe, shprint,
4+
current_directory, info, Recipe)
5+
from pythonforandroid.patching import will_build, check_any
6+
import sh
7+
from os.path import join
8+
9+
10+
class LxmlRecipe(CythonRecipe):
11+
version = '3.7.2'
12+
url = 'https://github.com/lxml/lxml/archive/lxml-{version}.tar.gz'
13+
name = 'lxml'
14+
depends = [('python2', 'python3crystax'), 'libxslt']
15+
16+
def get_recipe_env(self, arch):
17+
env = super(LxmlRecipe, self).get_recipe_env(arch)
18+
19+
libxslt_recipe = Recipe.get_recipe('libxslt', self.ctx)
20+
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
21+
22+
env['CC'] = env['CC'] + ' -I{libxslt_dir}/include -I{libxslt_dir}'.format(
23+
librslt_dir=libxslt_recipe.get_build_dir(arch))
24+
25+
env['LDFLAGS'] = ('-Llibxslt_dir/libxslt/.libs -Llibxslt_dir/libexslt/.libs '
26+
'-Llibxml2_dir/.libs -Llibxslt_dir/libxslt -Llibxslt_dir/libexslt '
27+
'-Llibxml2_dir/ ').format(libxslt_dir=libxslt_recipe.get_build_dir(arch),
28+
libxml2_dir=libxml2_recipe.get_build_dir(arch))
29+
30+
# env['LDSHARED'] = env['LIBLINK'] # not sure this is necessary in new toolchain
31+
32+
recipe = LxmlRecipe()

pythonforandroid/recipes/requests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pythonforandroid.toolchain import PythonRecipe
22

33
class RequestsRecipe(PythonRecipe):
4-
version = '2.9.1'
4+
version = '2.12.3'
55
url = 'https://github.com/kennethreitz/requests/archive/v{version}.tar.gz'
66
depends = ['hostpython2', 'setuptools']
77
site_packages_name = 'requests'

0 commit comments

Comments
 (0)