Skip to content

Commit

Permalink
numpy: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Dynamos committed Mar 20, 2024
1 parent ef829d5 commit 26a5415
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
20 changes: 18 additions & 2 deletions pythonforandroid/recipes/numpy/__init__.py
@@ -1,4 +1,4 @@
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
from pythonforandroid.logger import shprint, info
from pythonforandroid.util import current_directory
from multiprocessing import cpu_count
Expand All @@ -13,7 +13,11 @@ class NumpyRecipe(CompiledComponentsPythonRecipe):
version = '1.22.3'
url = 'https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip'
site_packages_name = 'numpy'
depends = ['setuptools', 'cython']
depends = ["cython"]

# This build specifically requires setuptools version 59.2.0
hostpython_prerequisites = ["setuptools==59.2.0"]

install_in_hostpython = True
call_hostpython_via_targetpython = False

Expand All @@ -36,6 +40,18 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):

return env

def build_arch(self, arch):
self.hostpython_prerequisites = ["setuptools==59.2.0"]
self.install_hostpython_prerequisites()

super().build_arch(arch)

# Post build step to restore setuptools version
self.hostpython_prerequisites = ["setuptools=={}".format(
Recipe.get_recipe("setuptools", self.ctx).version)
]
self.install_hostpython_prerequisites()

def _build_compiled_components(self, arch):
info('Building compiled components in {}'.format(self.name))

Expand Down
16 changes: 13 additions & 3 deletions pythonforandroid/recipes/setuptools/__init__.py
@@ -1,11 +1,21 @@
from os.path import exists, join
from pythonforandroid.logger import info
from pythonforandroid.recipe import PythonRecipe


class SetuptoolsRecipe(PythonRecipe):
version = '69.0.3'
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz'
call_hostpython_via_targetpython = False
install_in_hostpython = True
hostpython_prerequisites = ["setuptools=={}".format(version)]

def should_build(self, arch):
if exists(join(self.hostpython_site_dir, "setuptools")):
info('Python package already exists in site-packages')
return False
info('setuptools apparently isn\'t already in site-packages')
return True

def build_arch(self, arch):
self.install_hostpython_prerequisites()


recipe = SetuptoolsRecipe()

0 comments on commit 26a5415

Please sign in to comment.