Skip to content

Commit

Permalink
lxml,libxslt,libxml2,beautifulsoup4 recipe added
Browse files Browse the repository at this point in the history
  • Loading branch information
yaki29 committed Jan 28, 2017
1 parent 99599aa commit c4b8969
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 15 deletions.
25 changes: 25 additions & 0 deletions pythonforandroid/recipes/beautifulsoup4/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

from pythonforandroid.toolchain import (PythonRecipe, shprint,
current_directory, info, Recipe)
from pythonforandroid.patching import will_build, check_any
import sh
from os.path import join

class BSoup4Recipe(PythonRecipe):
version = '4.1.0'
url = 'https://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/beautifulsoup4-{version}.tar.gz'
depends = [('python2', 'python3crystax'), 'lxml']
site_packages_name = 'beautifulsoup4'
call_hostpython_via_targetpython = True
def get_recipe_env(self, arch):
env = super(BSoup4Recipe, self).get_recipe_env(arch)


lxml_recipe = Recipe.get_recipe('lxml', self.ctx)

env['CC'] = env['CC'] + ' -I{lxml_dir}/include -I{lxml_dir}'.format(
lxml_dir=lxml_recipe.get_build_dir(arch))

env['LDFLAGS'] = ('-Llxml_dir/lxml/.libs -Llxml_dir/lxml/.libs ').format(lxml_dir=lxml_recipe.get_build_dir(arch))

recipe = BSoup4Recipe()
19 changes: 5 additions & 14 deletions pythonforandroid/recipes/libxml2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,18 @@
from os.path import join


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

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

try:
sh.sed('runtest\$(EXEEXT) \\/ \\/', 'Makefile')
except:
pass
try:
sh.sed('testrecurse\$(EXEEXT)$//', 'Makefile')
except:
pass
try:
sh.make('-j', '$MAKE_JOBS')
except:
pass
sh.sed('runtest$(EXEEXT) \/ \/', 'Makefile')
sh.sed('testrecurse$(EXEEXT)$//', 'Makefile')
sh.make('-j', '5')


recipe = Libxml2Recipe()
23 changes: 23 additions & 0 deletions pythonforandroid/recipes/libxslt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from pythonforandroid.toolchain import (CythonRecipe, shprint,
current_directory, info, Recipe)
from pythonforandroid.patching import will_build, check_any
import sh
from os.path import exists,join

class LibxsltRecipe(CythonRecipe):
version = '1.1.29'
url = 'ftp://xmlsoft.org/libxslt/libxslt-{version}.tar.gz'
name = 'libxslt'
depends = [('python2', 'python3crystax'), 'libxml2']
patches = ['fix-dlopen.patch']

def should_build(self, arch):
return not exists(join(self.get_build_container_dir(arch.arch),"libxslt/.libs/libxslt.a"))


def get_recipe_env(self, arch):
env = super(LibxsltRecipe, self).get_recipe_env(arch)
sh.make('-j', '5')


recipe = LibxsltRecipe()
11 changes: 11 additions & 0 deletions pythonforandroid/recipes/libxslt/fix-dlopen.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- libxslt-1.1.27.orig/python/libxsl.py 2012-09-04 16:26:23.000000000 +0200
+++ libxslt-1.1.27/python/libxsl.py 2013-07-29 15:11:04.182227378 +0200
@@ -4,7 +4,7 @@
# loader to work in that mode if feasible
#
import sys
-if not hasattr(sys,'getdlopenflags'):
+if True:
import libxml2mod
import libxsltmod
import libxml2
32 changes: 32 additions & 0 deletions pythonforandroid/recipes/lxml/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@


from pythonforandroid.toolchain import (CythonRecipe, shprint,
current_directory, info, Recipe)
from pythonforandroid.patching import will_build, check_any
import sh
from os.path import join


class LxmlRecipe(CythonRecipe):
version = '3.7.2'
url = 'https://github.com/lxml/lxml/archive/lxml-{version}.tar.gz'
name = 'lxml'
depends = [('python2', 'python3crystax'), 'libxslt']

def get_recipe_env(self, arch):
env = super(LxmlRecipe, self).get_recipe_env(arch)

libxslt_recipe = Recipe.get_recipe('libxslt', self.ctx)
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)

env['CC'] = env['CC'] + ' -I{libxslt_dir}/include -I{libxslt_dir}'.format(
librslt_dir=libxslt_recipe.get_build_dir(arch))

env['LDFLAGS'] = ('-Llibxslt_dir/libxslt/.libs -Llibxslt_dir/libexslt/.libs '
'-Llibxml2_dir/.libs -Llibxslt_dir/libxslt -Llibxslt_dir/libexslt '
'-Llibxml2_dir/ ').format(libxslt_dir=libxslt_recipe.get_build_dir(arch),
libxml2_dir=libxml2_recipe.get_build_dir(arch))

# env['LDSHARED'] = env['LIBLINK'] # not sure this is necessary in new toolchain

recipe = LxmlRecipe()
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/requests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pythonforandroid.toolchain import PythonRecipe

class RequestsRecipe(PythonRecipe):
version = '2.9.1'
version = '2.12.3'
url = 'https://github.com/kennethreitz/requests/archive/v{version}.tar.gz'
depends = ['hostpython2', 'setuptools']
site_packages_name = 'requests'
Expand Down

0 comments on commit c4b8969

Please sign in to comment.