From 879ced4c69c3c717a6c0dc6d82251262c75a8f34 Mon Sep 17 00:00:00 2001 From: rbebb <33609541+rbebb@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:06:45 -0400 Subject: [PATCH 1/4] Update Shapely to 2.0.6 --- server/pypi/packages/shapely/meta.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/pypi/packages/shapely/meta.yaml b/server/pypi/packages/shapely/meta.yaml index 4d410cbb30..a2f67b3f1f 100644 --- a/server/pypi/packages/shapely/meta.yaml +++ b/server/pypi/packages/shapely/meta.yaml @@ -1,16 +1,16 @@ {% if PY_VER == "3.8" %} - {% set numpy_version = "1.19.5" %} -{% else %} {% set numpy_version = "1.23.3" %} +{% else %} + {% set numpy_version = "1.26.2" %} {% endif %} package: name: Shapely - version: "1.8.5" + version: "2.0.6" requirements: build: - - cython 0.29.32 + - cython host: - chaquopy-geos 3.8.1 - numpy {{ numpy_version }} From 0b1f55db47890fc166297d6a8a33a63af9c0ba2f Mon Sep 17 00:00:00 2001 From: rbebb <33609541+rbebb@users.noreply.github.com> Date: Sun, 3 Nov 2024 23:38:17 -0500 Subject: [PATCH 2/4] Update Shapely meta.yaml - Revert numpy version change - Remove build requirements now that the build-wheel tool can install build-system requirements from a pyproject.toml file --- server/pypi/packages/shapely/meta.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/pypi/packages/shapely/meta.yaml b/server/pypi/packages/shapely/meta.yaml index a2f67b3f1f..e9935296e4 100644 --- a/server/pypi/packages/shapely/meta.yaml +++ b/server/pypi/packages/shapely/meta.yaml @@ -1,7 +1,7 @@ {% if PY_VER == "3.8" %} - {% set numpy_version = "1.23.3" %} + {% set numpy_version = "1.19.5" %} {% else %} - {% set numpy_version = "1.26.2" %} + {% set numpy_version = "1.23.3" %} {% endif %} package: @@ -9,8 +9,6 @@ package: version: "2.0.6" requirements: - build: - - cython host: - chaquopy-geos 3.8.1 - numpy {{ numpy_version }} From 64d57707b164c0d192015fc26d1f968e01640894 Mon Sep 17 00:00:00 2001 From: rbebb <33609541+rbebb@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:50:10 -0400 Subject: [PATCH 3/4] Update Shapely to 2.0.7 --- server/pypi/packages/shapely/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/pypi/packages/shapely/meta.yaml b/server/pypi/packages/shapely/meta.yaml index e9935296e4..6a1147ee5c 100644 --- a/server/pypi/packages/shapely/meta.yaml +++ b/server/pypi/packages/shapely/meta.yaml @@ -6,7 +6,7 @@ package: name: Shapely - version: "2.0.6" + version: "2.0.7" requirements: host: From ae9d46a78696b02713e6674e093d47e8dd1c4616 Mon Sep 17 00:00:00 2001 From: rbebb <33609541+rbebb@users.noreply.github.com> Date: Sat, 5 Apr 2025 19:23:39 +0000 Subject: [PATCH 4/4] Update patch file --- .../packages/shapely/patches/chaquopy.patch | 129 ++++++++++-------- 1 file changed, 74 insertions(+), 55 deletions(-) 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)