Skip to content

Commit 0194a23

Browse files
committed
Changed apply_patch to pass arch argument
1 parent b9e6e52 commit 0194a23

File tree

12 files changed

+74
-70
lines changed

12 files changed

+74
-70
lines changed

pythonforandroid/recipes/numpy/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def prebuild_arch(self, arch):
2020
print('numpy already patched, skipping')
2121
return
2222

23-
self.apply_patch('patches/fix-numpy.patch')
24-
self.apply_patch('patches/prevent_libs_check.patch')
25-
self.apply_patch('patches/ar.patch')
26-
self.apply_patch('patches/lib.patch')
23+
self.apply_patch('patches/fix-numpy.patch', arch.arch)
24+
self.apply_patch('patches/prevent_libs_check.patch', arch.arch)
25+
self.apply_patch('patches/ar.patch', arch.arch)
26+
self.apply_patch('patches/lib.patch', arch.arch)
2727

2828
# AND: Fix this warning!
2929
warning('Numpy is built assuming the archiver name is '

pythonforandroid/recipes/pygame/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def prebuild_armeabi(self):
3232
return
3333
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),
3434
join(self.get_build_dir('armeabi'), 'Setup'))
35-
self.apply_patch(join('patches', 'fix-surface-access.patch'))
36-
self.apply_patch(join('patches', 'fix-array-surface.patch'))
37-
self.apply_patch(join('patches', 'fix-sdl-spam-log.patch'))
35+
self.apply_patch(join('patches', 'fix-surface-access.patch'), arch.arch)
36+
self.apply_patch(join('patches', 'fix-array-surface.patch'), arch.arch)
37+
self.apply_patch(join('patches', 'fix-sdl-spam-log.patch'), arch.arch)
3838
shprint(sh.touch, join(self.get_build_container_dir('armeabi'), '.patched'))
3939

4040
def build_armeabi(self):

pythonforandroid/recipes/pyjnius/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def prebuild_arch(self, arch):
1818
if exists(join(build_dir, '.patched')):
1919
print('pyjniussdl2 already pathed, skipping')
2020
return
21-
self.apply_patch('sdl2_jnienv_getter.patch')
21+
self.apply_patch('sdl2_jnienv_getter.patch', arch.arch)
2222
shprint(sh.touch, join(build_dir, '.patched'))
2323

2424
def postbuild_arch(self, arch):

pythonforandroid/recipes/pyopenssl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def prebuild_arch(self, arch):
2222
if exists(join(build_dir, '.patched')):
2323
print('pyOpenSSL already patched, skipping')
2424
return
25-
self.apply_patch('fix-dlfcn.patch')
25+
self.apply_patch('fix-dlfcn.patch', arch.arch)
2626
shprint(sh.touch, join(build_dir, '.patched'))
2727

2828
def get_recipe_env(self, arch):

pythonforandroid/recipes/python2/__init__.py

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,46 @@ class Python2Recipe(Recipe):
1515
conflicts = ['python3']
1616
opt_depends = ['openssl']
1717

18-
def prebuild_armeabi(self):
19-
build_dir = self.get_build_container_dir('armeabi')
18+
def prebuild_arch(self, arch):
19+
build_dir = self.get_build_container_dir(arch.arch)
2020
if exists(join(build_dir, '.patched')):
2121
info('Python2 already patched, skipping.')
2222
return
23-
self.apply_patch(join('patches', 'Python-{}-xcompile.patch'.format(self.version)))
24-
self.apply_patch(join('patches', 'Python-{}-ctypes-disable-wchar.patch'.format(self.version)))
25-
self.apply_patch(join('patches', 'disable-modules.patch'))
26-
self.apply_patch(join('patches', 'fix-locale.patch'))
27-
self.apply_patch(join('patches', 'fix-gethostbyaddr.patch'))
28-
self.apply_patch(join('patches', 'fix-setup-flags.patch'))
29-
self.apply_patch(join('patches', 'fix-filesystemdefaultencoding.patch'))
30-
self.apply_patch(join('patches', 'fix-termios.patch'))
31-
self.apply_patch(join('patches', 'custom-loader.patch'))
32-
self.apply_patch(join('patches', 'verbose-compilation.patch'))
33-
self.apply_patch(join('patches', 'fix-remove-corefoundation.patch'))
34-
self.apply_patch(join('patches', 'fix-dynamic-lookup.patch'))
35-
self.apply_patch(join('patches', 'fix-dlfcn.patch'))
36-
self.apply_patch(join('patches', 'parsetuple.patch'))
37-
# self.apply_patch(join('patches', 'ctypes-find-library.patch'))
38-
self.apply_patch(join('patches', 'ctypes-find-library-updated.patch'))
23+
self.apply_patch(join('patches', 'Python-{}-xcompile.patch'.format(self.version)),
24+
arch.arch)
25+
self.apply_patch(join('patches', 'Python-{}-ctypes-disable-wchar.patch'.format(self.version)),
26+
arch.arch)
27+
self.apply_patch(join('patches', 'disable-modules.patch'), arch.arch)
28+
self.apply_patch(join('patches', 'fix-locale.patch'), arch.arch)
29+
self.apply_patch(join('patches', 'fix-gethostbyaddr.patch'), arch.arch)
30+
self.apply_patch(join('patches', 'fix-setup-flags.patch'), arch.arch)
31+
self.apply_patch(join('patches', 'fix-filesystemdefaultencoding.patch'), arch.arch)
32+
self.apply_patch(join('patches', 'fix-termios.patch'), arch.arch)
33+
self.apply_patch(join('patches', 'custom-loader.patch'), arch.arch)
34+
self.apply_patch(join('patches', 'verbose-compilation.patch'), arch.arch)
35+
self.apply_patch(join('patches', 'fix-remove-corefoundation.patch'), arch.arch)
36+
self.apply_patch(join('patches', 'fix-dynamic-lookup.patch'), arch.arch)
37+
self.apply_patch(join('patches', 'fix-dlfcn.patch'), arch.arch)
38+
self.apply_patch(join('patches', 'parsetuple.patch'), arch.arch)
39+
# self.apply_patch(join('patches', 'ctypes-find-library.patch'), arch.arch)
40+
self.apply_patch(join('patches', 'ctypes-find-library-updated.patch'), arch.arch)
3941

4042
if uname()[0] == 'Linux':
41-
self.apply_patch(join('patches', 'fix-configure-darwin.patch'))
42-
self.apply_patch(join('patches', 'fix-distutils-darwin.patch'))
43+
self.apply_patch(join('patches', 'fix-configure-darwin.patch'), arch.arch)
44+
self.apply_patch(join('patches', 'fix-distutils-darwin.patch'), arch.arch)
4345

4446
if self.ctx.android_api > 19:
45-
self.apply_patch(join('patches', 'fix-ftime-removal.patch'))
47+
self.apply_patch(join('patches', 'fix-ftime-removal.patch'), arch.arch)
4648

4749
shprint(sh.touch, join(build_dir, '.patched'))
4850

49-
def build_armeabi(self):
51+
def build_arch(self, arch):
5052

51-
if not exists(join(self.get_build_dir('armeabi'), 'libpython2.7.so')):
53+
if not exists(join(self.get_build_dir(arch.arch), 'libpython2.7.so')):
5254
self.do_python_build()
5355

5456
if not exists(self.ctx.get_python_install_dir()):
55-
shprint(sh.cp, '-a', join(self.get_build_dir('armeabi'), 'python-install'),
57+
shprint(sh.cp, '-a', join(self.get_build_dir(arch.arch), 'python-install'),
5658
self.ctx.get_python_install_dir())
5759

5860
# This should be safe to run every time
@@ -61,11 +63,11 @@ def build_armeabi(self):
6163
join(self.ctx.get_python_install_dir(), 'bin', 'python.host'))
6264
self.ctx.hostpython = join(self.ctx.get_python_install_dir(), 'bin', 'python.host')
6365

64-
if not exists(join(self.ctx.get_libs_dir('armeabi'), 'libpython2.7.so')):
65-
shprint(sh.cp, join(self.get_build_dir('armeabi'), 'libpython2.7.so'), self.ctx.get_libs_dir('armeabi'))
66+
if not exists(join(self.ctx.get_libs_dir(arch.arch), 'libpython2.7.so')):
67+
shprint(sh.cp, join(self.get_build_dir(arch.arch), 'libpython2.7.so'), self.ctx.get_libs_dir(arch.arch))
6668

6769

68-
# # if exists(join(self.get_build_dir('armeabi'), 'libpython2.7.so')):
70+
# # if exists(join(self.get_build_dir(arch.arch), 'libpython2.7.so')):
6971
# if exists(join(self.ctx.libs_dir, 'libpython2.7.so')):
7072
# info('libpython2.7.so already exists, skipping python build.')
7173
# if not exists(join(self.ctx.get_python_install_dir(), 'libpython2.7.so')):
@@ -81,12 +83,12 @@ def do_python_build(self):
8183
exit(1)
8284

8385
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
84-
shprint(sh.cp, self.ctx.hostpython, self.get_build_dir('armeabi'))
85-
shprint(sh.cp, self.ctx.hostpgen, self.get_build_dir('armeabi'))
86-
hostpython = join(self.get_build_dir('armeabi'), 'hostpython')
87-
hostpgen = join(self.get_build_dir('armeabi'), 'hostpython')
86+
shprint(sh.cp, self.ctx.hostpython, self.get_build_dir(arch.arch))
87+
shprint(sh.cp, self.ctx.hostpgen, self.get_build_dir(arch.arch))
88+
hostpython = join(self.get_build_dir(arch.arch), 'hostpython')
89+
hostpgen = join(self.get_build_dir(arch.arch), 'hostpython')
8890

89-
with current_directory(self.get_build_dir('armeabi')):
91+
with current_directory(self.get_build_dir(arch.arch)):
9092

9193

9294
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
@@ -104,7 +106,7 @@ def do_python_build(self):
104106
# TODO need to add a should_build that checks if optional
105107
# dependencies have changed (possibly in a generic way)
106108
if 'openssl' in self.ctx.recipe_build_order:
107-
openssl_build_dir = Recipe.get_recipe('openssl', self.ctx).get_build_dir('armeabi')
109+
openssl_build_dir = Recipe.get_recipe('openssl', self.ctx).get_build_dir(arch.arch)
108110
env['CFLAGS'] = ' '.join([env['CFLAGS'],
109111
'-I{}'.format(join(openssl_build_dir, 'include'))])
110112
env['LDFLAGS'] = ' '.join([env['LDFLAGS'],

pythonforandroid/recipes/python3/__init__.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Python3Recipe(Recipe):
1313
depends = ['hostpython3']
1414
conflicts = ['python2']
1515

16-
def prebuild_armeabi(self):
17-
build_dir = self.get_build_container_dir('armeabi')
16+
def prebuild_arch(self, arch):
17+
build_dir = self.get_build_container_dir(arch.arch)
1818
if exists(join(build_dir, '.patched')):
1919
print('Python3 already patched, skipping.')
2020
return
@@ -30,38 +30,39 @@ def prebuild_armeabi(self):
3030
# 'python-{version}-locale_and_android_misc.patch'.format(version=self.version)))
3131

3232

33-
self.apply_patch(join('patches', 'python-{version}-android-libmpdec.patch'.format(version=self.version)))
34-
self.apply_patch(join('patches', 'python-{version}-android-locale.patch'.format(version=self.version)))
35-
self.apply_patch(join('patches', 'python-{version}-android-misc.patch'.format(version=self.version)))
36-
# self.apply_patch(join('patches', 'python-{version}-android-missing-getdents64-definition.patch'.format(version=self.version)))
37-
self.apply_patch(join('patches', 'python-{version}-cross-compile.patch'.format(version=self.version)))
38-
self.apply_patch(join('patches', 'python-{version}-python-misc.patch'.format(version=self.version)))
33+
self.apply_patch(join('patches', 'python-{version}-android-libmpdec.patch'.format(version=self.version)),
34+
arch.arch)
35+
self.apply_patch(join('patches', 'python-{version}-android-locale.patch'.format(version=self.version)), arch.arch)
36+
self.apply_patch(join('patches', 'python-{version}-android-misc.patch'.format(version=self.version)), arch.arch)
37+
# self.apply_patch(join('patches', 'python-{version}-android-missing-getdents64-definition.patch'.format(version=self.version)), arch.arch)
38+
self.apply_patch(join('patches', 'python-{version}-cross-compile.patch'.format(version=self.version)), arch.arch)
39+
self.apply_patch(join('patches', 'python-{version}-python-misc.patch'.format(version=self.version)), arch.arch)
3940

40-
self.apply_patch(join('patches', 'python-{version}-libpymodules_loader.patch'.format(version=self.version)))
41-
self.apply_patch('log_failures.patch')
41+
self.apply_patch(join('patches', 'python-{version}-libpymodules_loader.patch'.format(version=self.version)), arch.arch)
42+
self.apply_patch('log_failures.patch', arch.arch)
4243

4344

4445
shprint(sh.touch, join(build_dir, '.patched'))
4546

46-
def build_armeabi(self):
47+
def build_arch(self, arch):
4748
if 'sqlite' in self.ctx.recipe_build_order or 'openssl' in self.ctx.recipe_build_order:
4849
print('sqlite or openssl support not yet enabled in python recipe')
4950
exit(1)
5051

5152
hostpython_recipe = Recipe.get_recipe('hostpython3', self.ctx)
52-
shprint(sh.cp, self.ctx.hostpython, self.get_build_dir('armeabi'))
53-
shprint(sh.cp, self.ctx.hostpgen, self.get_build_dir('armeabi'))
54-
hostpython = join(self.get_build_dir('armeabi'), 'hostpython')
55-
hostpgen = join(self.get_build_dir('armeabi'), 'hostpython')
53+
shprint(sh.cp, self.ctx.hostpython, self.get_build_dir(arch.arch))
54+
shprint(sh.cp, self.ctx.hostpgen, self.get_build_dir(arch.arch))
55+
hostpython = join(self.get_build_dir(arch.arch), 'hostpython')
56+
hostpgen = join(self.get_build_dir(arch.arch), 'hostpython')
5657

57-
if exists(join(self.get_build_dir('armeabi'), 'libpython3.4m.so')):
58+
if exists(join(self.get_build_dir(arch.arch), 'libpython3.4m.so')):
5859
print('libpython3.4m.so already exists, skipping python build.')
5960
self.ctx.hostpython = join(self.ctx.build_dir, 'python-install',
6061
'bin', 'python.host')
6162

6263
return
6364

64-
with current_directory(self.get_build_dir('armeabi')):
65+
with current_directory(self.get_build_dir(arch.arch)):
6566

6667

6768
hostpython_recipe = Recipe.get_recipe('hostpython3', self.ctx)

pythonforandroid/recipes/sdl2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def prebuild_arch(self, arch):
1818
if exists(join(build_dir, '.patched')):
1919
info('SDL2 already patched, skipping')
2020
return
21-
self.apply_patch('add_nativeSetEnv.patch')
21+
self.apply_patch('add_nativeSetEnv.patch', arch.arch)
2222
shprint(sh.touch, join(build_dir, '.patched'))
2323

2424
def build_arch(self, arch):

pythonforandroid/recipes/sdl2_image/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def prebuild_arch(self, arch):
1313
if exists(join(build_dir, '.patched')):
1414
info('SDL2_image already patched, skipping')
1515
return
16-
self.apply_patch('disable_webp.patch')
16+
self.apply_patch('disable_webp.patch', arch.arch)
1717
shprint(sh.touch, join(build_dir, '.patched'))
1818

1919
recipe = LibSDL2Image()

pythonforandroid/recipes/sdl2_mixer/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def prebuild_arch(self, arch):
1414
if exists(join(build_dir, '.patched')):
1515
info('SDL2_mixer already patched, skipping')
1616
return
17-
self.apply_patch('disable_modplug_mikmod_smpeg.patch')
17+
self.apply_patch('disable_modplug_mikmod_smpeg.patch',
18+
arch.arch)
1819
shprint(sh.touch, join(build_dir, '.patched'))
1920

2021
recipe = LibSDL2Mixer()

pythonforandroid/recipes/sdl2python3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def prebuild_arch(self, arch):
1717
if exists(join(build_dir, '.patched')):
1818
print('SDL2 already patched, skipping')
1919
return
20-
self.apply_patch('add_nativeSetEnv.patch')
20+
self.apply_patch('add_nativeSetEnv.patch', arch.arch)
2121
shprint(sh.touch, join(build_dir, '.patched'))
2222

2323
def build_arch(self, arch):

pythonforandroid/recipes/vispy/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ def prebuild_arch(self, arch):
2222
if exists(join(build_dir, '.patched')):
2323
print('vispy already patched, skipping')
2424
return
25-
self.apply_patch('disable_freetype.patch')
26-
self.apply_patch('disable_font_triage.patch')
27-
self.apply_patch('use_es2.patch')
28-
self.apply_patch('remove_ati_check.patch')
25+
self.apply_patch('disable_freetype.patch', arch.arch)
26+
self.apply_patch('disable_font_triage.patch', arch.arch)
27+
self.apply_patch('use_es2.patch', arch.arch)
28+
self.apply_patch('remove_ati_check.patch', arch.arch)
2929

30-
self.apply_patch('make_shader_es2_compliant.patch')
31-
self.apply_patch('detect_finger_events.patch')
30+
self.apply_patch('make_shader_es2_compliant.patch', arch.arch)
31+
self.apply_patch('detect_finger_events.patch', arch.arch)
3232

3333
shprint(sh.touch, join(build_dir, '.patched'))
3434

pythonforandroid/toolchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ def extract_source(self, source, cwd):
17161716
# print("Unrecognized extension for {}".format(filename))
17171717
# raise Exception()
17181718

1719-
def apply_patch(self, filename, arch='armeabi'):
1719+
def apply_patch(self, filename, arch):
17201720
"""
17211721
Apply a patch from the current recipe directory into the current
17221722
build directory.

0 commit comments

Comments
 (0)