From 7572fc53e2255bd5dc355338ac8c7a7453191c87 Mon Sep 17 00:00:00 2001 From: Ryan Pessa Date: Thu, 14 Jan 2016 10:02:32 -0600 Subject: [PATCH] fix mysqldb patching --- pythonforandroid/recipes/mysqldb/__init__.py | 13 +++++++++++++ pythonforandroid/recipes/mysqldb/disable-zip.patch | 2 +- .../recipes/mysqldb/override-mysql-config.patch | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pythonforandroid/recipes/mysqldb/__init__.py b/pythonforandroid/recipes/mysqldb/__init__.py index 1c16a7e7e4..b217bbb64d 100644 --- a/pythonforandroid/recipes/mysqldb/__init__.py +++ b/pythonforandroid/recipes/mysqldb/__init__.py @@ -15,6 +15,19 @@ class MysqldbRecipe(CompiledComponentsPythonRecipe): # call_hostpython_via_targetpython = False + def convert_newlines(self, filename): + print('converting newlines in {}'.format(filename)) + with open(filename, 'rb') as f: + data = f.read() + with open(filename, 'wb') as f: + f.write(data.replace(b'\r\n', b'\n').replace(b'\r', b'\n')) + + def prebuild_arch(self, arch): + super(MysqldbRecipe, self).prebuild_arch(arch) + setupbase = join(self.get_build_dir(arch.arch), 'setup') + self.convert_newlines(setupbase + '.py') + self.convert_newlines(setupbase + '_posix.py') + def get_recipe_env(self, arch=None): env = super(MysqldbRecipe, self).get_recipe_env(arch) diff --git a/pythonforandroid/recipes/mysqldb/disable-zip.patch b/pythonforandroid/recipes/mysqldb/disable-zip.patch index 46ecc7ee91..51f804ea2c 100644 --- a/pythonforandroid/recipes/mysqldb/disable-zip.patch +++ b/pythonforandroid/recipes/mysqldb/disable-zip.patch @@ -1,5 +1,5 @@ --- mysqldb/setup.py 2014-01-02 13:52:50.000000000 -0600 -+++ b/setup.py 2016-01-11 15:25:09.375114016 -0600 ++++ b/setup.py 2016-01-13 15:48:36.781216443 -0600 @@ -18,4 +18,5 @@ metadata['ext_modules'] = [ setuptools.Extension(sources=['_mysql.c'], **options)] diff --git a/pythonforandroid/recipes/mysqldb/override-mysql-config.patch b/pythonforandroid/recipes/mysqldb/override-mysql-config.patch index 2d240bdfc1..195ebdacbc 100644 --- a/pythonforandroid/recipes/mysqldb/override-mysql-config.patch +++ b/pythonforandroid/recipes/mysqldb/override-mysql-config.patch @@ -1,5 +1,5 @@ --- mysqldb/setup_posix.py 2014-01-02 13:52:50.000000000 -0600 -+++ b/setup_posix.py 2016-01-11 14:38:33.603528571 -0600 ++++ b/setup_posix.py 2016-01-13 15:48:18.732883429 -0600 @@ -13,17 +13,7 @@ return "-%s" % f