2
2
from pythonforandroid .util import ensure_dir
3
3
4
4
from os .path import join
5
+ import shutil
5
6
6
7
7
8
class MatplotlibRecipe (CppCompiledComponentsPythonRecipe ):
@@ -13,14 +14,6 @@ class MatplotlibRecipe(CppCompiledComponentsPythonRecipe):
13
14
14
15
python_depends = ['cycler' , 'fonttools' , 'packaging' , 'pyparsing' , 'python-dateutil' ]
15
16
16
- # We need to patch to:
17
- # - make mpl install work without importing numpy
18
- # - make mpl use shared libraries for freetype and png
19
- # - make mpl link to png16, to match p4a library name for png
20
- # - prevent mpl trying to build TkAgg, which wouldn't work
21
- # on Android anyway but has build issues
22
- # patches = ['mpl_android_fixes.patch']
23
-
24
17
def generate_libraries_pc_files (self , arch ):
25
18
"""
26
19
Create *.pc files for libraries that `matplotib` depends on.
@@ -63,39 +56,21 @@ def generate_libraries_pc_files(self, arch):
63
56
pc_file .write (text_buffer )
64
57
65
58
def prebuild_arch (self , arch ):
66
- with open (join (self .get_recipe_dir (), 'setup.cfg.template' )) as fileh :
67
- setup_cfg = fileh .read ()
68
-
69
- with open (join (self .get_build_dir (arch ), 'mplsetup.cfg' ), 'w' ) as fileh :
70
- fileh .write (setup_cfg .format (
71
- ndk_sysroot_usr = join (self .ctx .ndk .sysroot , 'usr' )))
72
-
59
+ shutil .copyfile (
60
+ join (self .get_recipe_dir (), "setup.cfg.template" ),
61
+ join (self .get_build_dir (arch ), "mplsetup.cfg" ),
62
+ )
73
63
self .generate_libraries_pc_files (arch )
74
64
75
65
def get_recipe_env (self , arch = None , with_flags_in_cc = True ):
76
66
env = super ().get_recipe_env (arch , with_flags_in_cc )
77
67
78
- # we modify `XDG_CACHE_HOME` to download `jquery-ui` into that folder,
79
- # or mpl install will fail when trying to download/install it, but if
80
- # we have the proper package already downloaded, it will use the cached
81
- # package to successfully finish the installation.
82
- # Note: this may not be necessary for some local systems, but it is
83
- # for our CI provider: `gh-actions`, which will
84
- # fail trying to download the `jquery-ui` package
85
- env ['XDG_CACHE_HOME' ] = join (self .get_build_dir (arch ), 'p4a_files' )
86
68
# we make use of the same directory than `XDG_CACHE_HOME`, for our
87
69
# custom library pc files, so we have all the install files that we
88
70
# generate at the same place
71
+ env ['XDG_CACHE_HOME' ] = join (self .get_build_dir (arch ), 'p4a_files' )
89
72
env ['PKG_CONFIG_PATH' ] = env ['XDG_CACHE_HOME' ]
90
73
91
- # We set a new environ variable `NUMPY_INCLUDES` to be able to tell
92
- # the matplotlib script where to find our numpy without importing it
93
- # (which will fail, because numpy isn't installed in our hostpython)
94
- env ['NUMPY_INCLUDES' ] = join (
95
- self .ctx .get_site_packages_dir (arch ),
96
- 'numpy' , 'core' , 'include' ,
97
- )
98
-
99
74
# creating proper *.pc files for our libraries does not seem enough to
100
75
# success with our build (without depending on system development
101
76
# libraries), but if we tell the compiler where to find our libraries
0 commit comments