lbry-android-sdk/p4a/pythonforandroid/recipes/shapely/setup.patch

45 lines
2 KiB
Diff
Raw Permalink Normal View History

2022-12-02 21:15:34 +01:00
This patch does three things:
- disable the libgeos check, because, even setting the proper env variables,
it fails to load our libgeos library, so we skip that because it's not
mandatory for the cythonizing.
- sets some environment variables into the setup.py file, so we can pass
our libgeos information (includes, lib path and libraries)
- force to raise an error when cython file to compile (our current build
system relies on this failure to do the proper `cythonizing`, if we don't
raise the error, we will end up with the package installed without the
speed optimizations.
--- Shapely-1.7a1/setup.py.orig 2018-07-29 22:53:13.000000000 +0200
+++ Shapely-1.7a1/setup.py 2019-02-24 14:26:19.178610660 +0100
@@ -82,8 +82,8 @@ if not (py_version == (2, 7) or py_versi
# Get geos_version from GEOS dynamic library, which depends on
# GEOS_LIBRARY_PATH and/or GEOS_CONFIG environment variables
-from shapely._buildcfg import geos_version_string, geos_version, \
- geos_config, get_geos_config
+# from shapely._buildcfg import geos_version_string, geos_version, \
+# geos_config, get_geos_config
logging.basicConfig()
log = logging.getLogger(__file__)
@@ -248,9 +248,9 @@ if sys.platform == 'win32':
setup_args['package_data']['shapely'].append('shapely/DLLs/*.dll')
# Prepare build opts and args for the speedups extension module.
-include_dirs = []
-library_dirs = []
-libraries = []
+include_dirs = os.environ.get('GEOS_INCLUDE_DIRS', '').split(',')
+library_dirs = os.environ.get('GEOS_LIBRARY_DIRS', '').split(',')
+libraries = os.environ.get('GEOS_LIBRARIES', '').split(',')
extra_link_args = []
# If NO_GEOS_CONFIG is set in the environment, geos-config will not
@@ -375,6 +375,7 @@ try:
construct_build_ext(existing_build_ext)
setup(ext_modules=ext_modules, **setup_args)
except BuildFailed as ex:
+ raise # Force python only build to fail
BUILD_EXT_WARNING = "The C extension could not be compiled, " \
"speedups are not enabled."
log.warn(ex)