Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add another patch for numpy 2.0 (v1.84.x branch) #211

Merged
merged 4 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .ci_support/linux_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ bzip2:
c_stdlib:
- sysroot
c_stdlib_version:
- '2.12'
- '2.17'
cdt_name:
- cos6
- cos7
channel_sources:
- conda-forge/label/numpy_rc,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down Expand Up @@ -54,6 +54,6 @@ zip_keys:
- numpy
- python_impl
zlib:
- '1.2'
- '1'
zstd:
- '1.5'
4 changes: 2 additions & 2 deletions .ci_support/linux_aarch64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cdt_arch:
cdt_name:
- cos7
channel_sources:
- conda-forge/label/numpy_rc,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down Expand Up @@ -58,6 +58,6 @@ zip_keys:
- numpy
- python_impl
zlib:
- '1.2'
- '1'
zstd:
- '1.5'
4 changes: 2 additions & 2 deletions .ci_support/linux_ppc64le_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ c_stdlib_version:
cdt_name:
- cos7
channel_sources:
- conda-forge/label/numpy_rc,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down Expand Up @@ -54,6 +54,6 @@ zip_keys:
- numpy
- python_impl
zlib:
- '1.2'
- '1'
zstd:
- '1.5'
6 changes: 4 additions & 2 deletions .ci_support/osx_64_.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
MACOSX_DEPLOYMENT_TARGET:
- '10.13'
MACOSX_SDK_VERSION:
- '10.13'
bzip2:
- '1'
c_stdlib:
- macosx_deployment_target
c_stdlib_version:
- '10.13'
channel_sources:
- conda-forge/label/numpy_rc,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down Expand Up @@ -52,6 +54,6 @@ zip_keys:
- numpy
- python_impl
zlib:
- '1.2'
- '1'
zstd:
- '1.5'
6 changes: 4 additions & 2 deletions .ci_support/osx_arm64_.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
MACOSX_DEPLOYMENT_TARGET:
- '11.0'
MACOSX_SDK_VERSION:
- '11.0'
bzip2:
- '1'
c_stdlib:
- macosx_deployment_target
c_stdlib_version:
- '11.0'
channel_sources:
- conda-forge/label/numpy_rc,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down Expand Up @@ -49,6 +51,6 @@ zip_keys:
- numpy
- python_impl
zlib:
- '1.2'
- '1'
zstd:
- '1.5'
4 changes: 2 additions & 2 deletions .ci_support/win_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ bzip2:
c_stdlib:
- vs
channel_sources:
- conda-forge/label/numpy_rc,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down Expand Up @@ -44,6 +44,6 @@ zip_keys:
- numpy
- python_impl
zlib:
- '1.2'
- '1'
zstd:
- '1.5'
4 changes: 2 additions & 2 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .scripts/run_win_build.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ source:
url: https://boostorg.jfrog.io/artifactory/main/release/{{ version }}/source/boost_{{ version|replace(".", "_") }}.tar.bz2
sha256: cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454
patches:
# ensure our compiler flags get used during bootstrapping
# ensure our compiler flags get used during bootstrapping
- patches/0001-Add-default-value-for-cxx-and-cxxflags-options-for-t.patch
# backport https://github.com/boostorg/locale/pull/212
- patches/0002-Reimplement-string_set-as-any_string.patch
# backport https://github.com/boostorg/python/pull/432
- patches/0003-Support-numpy-2.0.0b1.patch
# backport https://github.com/boostorg/python/pull/443
- patches/0004-Support-numpy-2.0.patch

build:
number: 3
number: 4
jakirkham marked this conversation as resolved.
Show resolved Hide resolved
script_env:
- PY_DUMMY_VER={{ PY_DUMMY_VER }}
- NP_DUMMY_VER={{ NP_DUMMY_VER }}
Expand Down
38 changes: 38 additions & 0 deletions recipe/patches/0004-Support-numpy-2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/libs/python/src/numpy/dtype.cpp b/libs/python/src/numpy/dtype.cpp
index da30d192..1ce8c6ec 100644
--- a/libs/python/src/numpy/dtype.cpp
+++ b/libs/python/src/numpy/dtype.cpp
@@ -107,32 +107,7 @@ int dtype::get_itemsize() const {
}

bool equivalent(dtype const & a, dtype const & b) {
- // On Windows x64, the behaviour described on
- // http://docs.scipy.org/doc/numpy/reference/c-api.array.html for
- // PyArray_EquivTypes unfortunately does not extend as expected:
- // "For example, on 32-bit platforms, NPY_LONG and NPY_INT are equivalent".
- // This should also hold for 64-bit platforms (and does on Linux), but not
- // on Windows. Implement an alternative:
-#ifdef _MSC_VER
- if (sizeof(long) == sizeof(int) &&
- // Manually take care of the type equivalence.
- ((a == dtype::get_builtin<long>() || a == dtype::get_builtin<int>()) &&
- (b == dtype::get_builtin<long>() || b == dtype::get_builtin<int>()) ||
- (a == dtype::get_builtin<unsigned int>() || a == dtype::get_builtin<unsigned long>()) &&
- (b == dtype::get_builtin<unsigned int>() || b == dtype::get_builtin<unsigned long>()))) {
- return true;
- } else {
- return PyArray_EquivTypes(
- reinterpret_cast<PyArray_Descr*>(a.ptr()),
- reinterpret_cast<PyArray_Descr*>(b.ptr())
- );
- }
-#else
- return PyArray_EquivTypes(
- reinterpret_cast<PyArray_Descr*>(a.ptr()),
- reinterpret_cast<PyArray_Descr*>(b.ptr())
- );
-#endif
+ return a == b;
h-vetinari marked this conversation as resolved.
Show resolved Hide resolved
}

namespace