diff --git a/server/pypi/packages/shapely/meta.yaml b/server/pypi/packages/shapely/meta.yaml index 4d410cbb30..6a1147ee5c 100644 --- a/server/pypi/packages/shapely/meta.yaml +++ b/server/pypi/packages/shapely/meta.yaml @@ -6,11 +6,9 @@ package: name: Shapely - version: "1.8.5" + version: "2.0.7" requirements: - build: - - cython 0.29.32 host: - chaquopy-geos 3.8.1 - numpy {{ numpy_version }} diff --git a/server/pypi/packages/shapely/patches/chaquopy.patch b/server/pypi/packages/shapely/patches/chaquopy.patch index 57a583ee0b..405941dc05 100644 --- a/server/pypi/packages/shapely/patches/chaquopy.patch +++ b/server/pypi/packages/shapely/patches/chaquopy.patch @@ -1,61 +1,80 @@ ---- src-original/setup.py 2020-01-28 17:21:32.000000000 +0000 -+++ src/setup.py 2020-08-13 22:40:42.501283313 +0000 -@@ -135,6 +137,7 @@ +diff --git a/pyproject.toml b/pyproject.toml +index cbba3cb..1c880d8 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -5,7 +5,7 @@ requires = [ + # as oldest-support-numpy was (customizable with a NPY_TARGET_VERSION + # define). For older Python versions (where NumPy 1.25 is not yet available) + # continue using oldest-support-numpy. +- "oldest-supported-numpy; python_version<'3.9'", ++ "numpy==1.19.5; python_version<'3.9'", # Use version available in Chaquopy package index + "numpy>=1.25; python_version>='3.9'", + "setuptools>=61.0.0", + ] +diff --git a/setup.py b/setup.py +index d49d722..e041ba5 100644 +--- a/setup.py ++++ b/setup.py +@@ -81,31 +81,34 @@ def get_geos_paths(): + "other link args for compiling against a GEOS version >=%s.", + MIN_GEOS_VERSION, + ) +- return {} ++ # return {} Chaquopy: Continue anyway - # Allow GEOS_CONFIG to be bypassed in favor of CFLAGS and LDFLAGS - # vars set by build environment. -+os.environ["NO_GEOS_CONFIG"] = "1" # Chaquopy - if os.environ.get('NO_GEOS_CONFIG'): - geos_config = None - else: -@@ -251,7 +254,7 @@ - # Prepare build opts and args for the speedups extension module. - include_dirs = [] - library_dirs = [] --libraries = [] -+libraries = ["geos_c"] # Chaquopy - extra_link_args = [] + def version_tuple(ver): + return tuple(int(itm) if itm.isnumeric() else itm for itm in ver.split(".")) - # If NO_GEOS_CONFIG is set in the environment, geos-config will not -@@ -320,6 +323,14 @@ - pyx_file = "shapely/speedups/_speedups.pyx" - c_file = "shapely/speedups/_speedups.c" +- if version_tuple(geos_version) < version_tuple(MIN_GEOS_VERSION): +- raise ImportError( +- f"GEOS version should be >={MIN_GEOS_VERSION}, found {geos_version}" +- ) ++ # Chaquopy: Skip the following block ++ # if version_tuple(geos_version) < version_tuple(MIN_GEOS_VERSION): ++ # raise ImportError( ++ # f"GEOS version should be >={MIN_GEOS_VERSION}, found {geos_version}" ++ # ) -+# Chaquopy: the .c files in the sdist aren't compatible with Python 3.8, so Cython needs to be -+# re-run. Touch all .pyx files: this will cause force_cython to be set (for `speedups`), and -+# also affect Cython.Distutils.build_ext (for `vectorize`). -+for dirpath, dirnames, filenames in os.walk("."): -+ for name in filenames: -+ if name.endswith(".pyx"): -+ os.utime(f"{dirpath}/{name}") +- libraries = [] ++ libraries = ["geos_c"] # Chaquopy + library_dirs = [] + include_dirs = ["./src"] + extra_link_args = [] +- for item in get_geos_config("--cflags").split(): +- if item.startswith("-I"): +- include_dirs.extend(item[2:].split(":")) +- +- for item in get_geos_config("--clibs").split(): +- if item.startswith("-L"): +- library_dirs.extend(item[2:].split(":")) +- elif item.startswith("-l"): +- libraries.append(item[2:]) +- else: +- extra_link_args.append(item) ++ ++ if geos_version: # Chaquopy: Skip ++ for item in get_geos_config("--cflags").split(): ++ if item.startswith("-I"): ++ include_dirs.extend(item[2:].split(":")) + - force_cython = False - # Always regenerate for sdist or absent c file - if 'sdist' in sys.argv or not os.path.exists(c_file): -@@ -337,6 +348,10 @@ - cmd_classes = setup_args.setdefault('cmdclass', {}) ++ for item in get_geos_config("--clibs").split(): ++ if item.startswith("-L"): ++ library_dirs.extend(item[2:].split(":")) ++ elif item.startswith("-l"): ++ libraries.append(item[2:]) ++ else: ++ extra_link_args.append(item) - try: -+ # Chaquopy -+ import builtins -+ builtins.__NUMPY_SETUP__ = True # Prevent the rest of NumPy from being imported. -+ - import numpy - from Cython.Distutils import build_ext as cython_build_ext - from distutils.extension import Extension as DistutilsExtension -@@ -358,6 +373,7 @@ - extra_link_args=extra_link_args,)) + return { + "include_dirs": include_dirs, +@@ -125,7 +128,9 @@ class build_ext(_build_ext): + + # Prevent numpy from thinking it is still in its setup process: + try: +- del builtins.__NUMPY_SETUP__ ++ # Chaquopy ++ builtins.__NUMPY_SETUP__ = True # Prevent the rest of NumPy from being imported. ++ # del builtins.__NUMPY_SETUP__ + except AttributeError: + pass - except ImportError: -+ raise # Chaquopy: don't continue without the module. - log.info("Numpy or Cython not available, shapely.vectorized submodule " - "not being built.") - force_cython = False -@@ -382,6 +398,7 @@ - construct_build_ext(existing_build_ext) - setup(ext_modules=ext_modules, **setup_args) - except BuildFailed as ex: -+ raise # Chaquopy: don't continue without the module. - BUILD_EXT_WARNING = "The C extension could not be compiled, " \ - "speedups are not enabled." - log.warning(ex)