From 942ad522d84c309cd766ad402eb4b313e35b7b1e Mon Sep 17 00:00:00 2001 From: Paolo Patruno Date: Thu, 16 Feb 2017 03:30:39 +0100 Subject: [PATCH] Add support for django with patch --- pythonforandroid/recipes/django/__init__.py | 20 +++++++++++++++++++ .../recipes/django/migration.patch | 14 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 pythonforandroid/recipes/django/__init__.py create mode 100644 pythonforandroid/recipes/django/migration.patch diff --git a/pythonforandroid/recipes/django/__init__.py b/pythonforandroid/recipes/django/__init__.py new file mode 100644 index 0000000000..e390c24b1b --- /dev/null +++ b/pythonforandroid/recipes/django/__init__.py @@ -0,0 +1,20 @@ +from pythonforandroid.toolchain import PythonRecipe + +class DjangoRecipe(PythonRecipe): + name = 'django' + version = '1.10.5' + url = 'https://pypi.python.org/packages/c3/c2/6096bf5d0caa4e3d5b985ac72e3a0c795e37fa7407d6c85460b2a105b467/Django-{version}.tar.gz' + MD5_django='3fce02f1e6461fec21f1f15ea7489924' + depends = ['hostpython2','setuptools'] + site_packages_name = 'django' + + patches = ['migration.patch',] + call_hostpython_via_targetpython = False + + def should_build(self, arch): + name = self.site_packages_name + if name is None: + name = self.name + return True + +recipe = DjangoRecipe() diff --git a/pythonforandroid/recipes/django/migration.patch b/pythonforandroid/recipes/django/migration.patch new file mode 100644 index 0000000000..6432f1f587 --- /dev/null +++ b/pythonforandroid/recipes/django/migration.patch @@ -0,0 +1,14 @@ +--- django/db/migrations/loader.py 2016-07-18 20:08:55.000000000 +0200 ++++ new/django/db/migrations/loader.py 2016-11-22 00:59:25.652385356 +0100 +@@ -100,6 +100,11 @@ + import_name = name.rsplit(".", 1)[0] + if import_name[0] not in "_.~": + migration_names.add(import_name) ++ ++ if name.endswith(".pyo"): ++ import_name = name.rsplit(".", 1)[0] ++ if import_name[0] not in "_.~": ++ migration_names.add(import_name) + # Load them + for migration_name in migration_names: + migration_module = import_module("%s.%s" % (module_name, migration_name))