33from pythonforandroid .util import current_directory
44from multiprocessing import cpu_count
55from os .path import join
6+ import os
67import glob
78import sh
89import shutil
910
1011
1112class NumpyRecipe (CompiledComponentsPythonRecipe ):
1213
13- version = '1.22.3'
14+ #version = '1.9.3'
15+ version = '1.18.1'
16+ #version = '1.23.3'
1417 url = 'https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip'
18+ #url = 'https://pypi.python.org/packages/source/n/numpy/numpy-{version}.tar.gz'
1519 site_packages_name = 'numpy'
16- depends = ['setuptools' , 'cython' ]
17- install_in_hostpython = True
20+ depends = ['setuptools' , 'cython' , 'hostpython3' ]
21+ #install_in_hostpython = True
22+ install_in_hostpython = False
1823 call_hostpython_via_targetpython = False
24+ #call_hostpython_via_targetpython = True
1925
2026 patches = [
21- join ("patches" , "remove-default-paths.patch" ),
2227 join ("patches" , "add_libm_explicitly_to_build.patch" ),
2328 join ("patches" , "ranlib.patch" ),
29+ join ("patches" , "fix_empty_doc_error_on_import.patch" ),
30+ join ("patches" , "remove-default-paths.patch" ),
31+ join ('patches' , 'hostnumpy-xlocale.patch' ),
32+ join ('patches' , 'compiler_cxx_fix.patch' ),
2433 ]
34+
2535
2636 def get_recipe_env (self , arch = None , with_flags_in_cc = True ):
37+ #PYTHON VENV (HOSTPYTHON) IS DECLARED DURING DEPENDENCIES DOWNLOAD
2738 env = super ().get_recipe_env (arch , with_flags_in_cc )
2839
2940 # _PYTHON_HOST_PLATFORM declares that we're cross-compiling
@@ -33,10 +44,15 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
3344 # NPY_DISABLE_SVML=1 allows numpy to build for non-AVX512 CPUs
3445 # See: https://github.com/numpy/numpy/issues/21196
3546 env ["NPY_DISABLE_SVML" ] = "1"
36-
47+ hostpython = sh .Command (self .hostpython_location )
48+ os .system ("wget https://bootstrap.pypa.io/get-pip.py" )
49+ shprint (hostpython , "get-pip.py" , "install" )
50+ shprint (hostpython , "-m" , "pip" , "install" , "setuptools" )
51+ shprint (hostpython , "-m" , "pip" , "install" , "cython" )
3752 return env
3853
3954 def _build_compiled_components (self , arch ):
55+ #PYTHON VENV (HOSTPYTHON) IS DECLARED DURING DEPENDENCIES DOWNLOAD
4056 info ('Building compiled components in {}' .format (self .name ))
4157
4258 env = self .get_recipe_env (arch )
@@ -47,24 +63,45 @@ def _build_compiled_components(self, arch):
4763 build_dir = glob .glob ('build/lib.*' )[0 ]
4864 shprint (sh .find , build_dir , '-name' , '"*.o"' , '-exec' ,
4965 env ['STRIP' ], '{}' , ';' , _env = env )
66+ hostpython = sh .Command (self .hostpython_location )
67+ os .system ("wget https://bootstrap.pypa.io/get-pip.py" )
68+ shprint (hostpython , "get-pip.py" , "install" )
69+ shprint (hostpython , "-m" , "pip" , "install" , "setuptools" )
70+ shprint (hostpython , "-m" , "pip" , "install" , "cython" )
5071
5172 def _rebuild_compiled_components (self , arch , env ):
5273 info ('Rebuilding compiled components in {}' .format (self .name ))
53-
74+ #PYTHON VENV (HOSTPYTHON) IS DECLARED DURING DEPENDENCIES DOWNLOAD
5475 hostpython = sh .Command (self .real_hostpython_location )
5576 shprint (hostpython , 'setup.py' , 'clean' , '--all' , '--force' , _env = env )
5677 shprint (hostpython , 'setup.py' , self .build_cmd , '-v' , _env = env ,
5778 * self .setup_extra_args )
58-
79+ os .system ("wget https://bootstrap.pypa.io/get-pip.py" )
80+ shprint (hostpython , "get-pip.py" , "install" )
81+ shprint (hostpython , "-m" , "pip" , "install" , "setuptools" )
82+ shprint (hostpython , "-m" , "pip" , "install" , "cython" )
83+
5984 def build_compiled_components (self , arch ):
85+ #PYTHON VENV (HOSTPYTHON) IS DECLARED DURING DEPENDENCIES DOWNLOAD
6086 self .setup_extra_args = ['-j' , str (cpu_count ())]
6187 self ._build_compiled_components (arch )
6288 self .setup_extra_args = []
89+ hostpython = sh .Command (self .hostpython_location )
90+ os .system ("wget https://bootstrap.pypa.io/get-pip.py" )
91+ shprint (hostpython , "get-pip.py" , "install" )
92+ shprint (hostpython , "-m" , "pip" , "install" , "setuptools" )
93+ shprint (hostpython , "-m" , "pip" , "install" , "cython" )
6394
6495 def rebuild_compiled_components (self , arch , env ):
96+ #PYTHON VENV (HOSTPYTHON) IS DECLARED DURING DEPENDENCIES DOWNLOAD
6597 self .setup_extra_args = ['-j' , str (cpu_count ())]
6698 self ._rebuild_compiled_components (arch , env )
6799 self .setup_extra_args = []
100+ hostpython = sh .Command (self .hostpython_location )
101+ os .system ("wget https://bootstrap.pypa.io/get-pip.py" )
102+ shprint (hostpython , "get-pip.py" , "install" )
103+ shprint (hostpython , "-m" , "pip" , "install" , "setuptools" )
104+ shprint (hostpython , "-m" , "pip" , "install" , "cython" )
68105
69106 def get_hostrecipe_env (self , arch ):
70107 env = super ().get_hostrecipe_env (arch )
@@ -73,3 +110,4 @@ def get_hostrecipe_env(self, arch):
73110
74111
75112recipe = NumpyRecipe ()
113+
0 commit comments