diff --git a/.github/workflows/windows-arm64-wheels.yml b/.github/workflows/windows-arm64-wheels.yml index 2c66c47..8e23ea4 100644 --- a/.github/workflows/windows-arm64-wheels.yml +++ b/.github/workflows/windows-arm64-wheels.yml @@ -87,6 +87,9 @@ jobs: git clone https://github.com/mlpack/mlpack cd mlpack git checkout $MLPACK_VERSION + sed -i.bk 's/${PACKAGE_VERSION}/${PACKAGE_VERSION}.post1/g' src/mlpack/bindings/python/setup.py.in + rm -f src/mlpack/bindings/python/setup.py.in.bk + patch -p1 < ../numpy2.patch - name: Generate setup.py shell: powershell diff --git a/Jenkinsfile b/Jenkinsfile index de2fc26..d4fe487 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,6 +23,12 @@ pipeline cd mlpack/ git checkout $MLPACK_VERSION + # Temporary patch: increment build number. + sed -i.bk 's/${PACKAGE_VERSION}/${PACKAGE_VERSION}.post1/g' src/mlpack/bindings/python/setup.py.in + rm -f src/mlpack/bindings/python/setup.py.in.bk + # Apply patches. + patch -p1 < ../numpy2.patch + mkdir build/ cd build/ cmake -DBUILD_PYTHON_BINDINGS=ON ../ diff --git a/azure-pipelines-macos-steps.yml b/azure-pipelines-macos-steps.yml index f6caccd..b1a62e9 100644 --- a/azure-pipelines-macos-steps.yml +++ b/azure-pipelines-macos-steps.yml @@ -11,6 +11,12 @@ steps: git clone https://github.com/mlpack/mlpack cd mlpack git checkout $(MLPACK_VERSION) + + # Temporary patch: increment build number. + sed -i.bk 's/${PACKAGE_VERSION}/${PACKAGE_VERSION}.post1/g' src/mlpack/bindings/python/setup.py.in + rm -f src/mlpack/bindings/python/setup.py.in.bk + # Apply patches. + patch -p1 < ../numpy2.patch displayName: Clone mlpack - bash: | diff --git a/azure-pipelines-windows-steps.yml b/azure-pipelines-windows-steps.yml index 0c0bba7..e5bdae1 100644 --- a/azure-pipelines-windows-steps.yml +++ b/azure-pipelines-windows-steps.yml @@ -53,6 +53,12 @@ steps: git clone https://github.com/mlpack/mlpack cd mlpack git checkout $(MLPACK_VERSION) + + # Temporary patch: increment build number. + sed -i.bk 's/${PACKAGE_VERSION}/${PACKAGE_VERSION}.post1/g' src/mlpack/bindings/python/setup.py.in + rm -f src/mlpack/bindings/python/setup.py.in.bk + # Apply patches. + patch -p1 < ../numpy2.patch displayName: Clone mlpack - powershell: | diff --git a/numpy2.patch b/numpy2.patch new file mode 100644 index 0000000..c56bde8 --- /dev/null +++ b/numpy2.patch @@ -0,0 +1,14 @@ +--- mlpack-4.4.0/src/mlpack/bindings/python/mlpack/matrix_utils.py 2024-05-28 16:08:34.000000000 -0400 ++++ mlpack/src/mlpack/bindings/python/mlpack/matrix_utils.py 2024-07-24 17:22:50.872603391 -0400 +@@ -160,7 +160,10 @@ + dims = len(x) + + d = np.zeros([dims]) +- out = np.array(x, dtype=dtype, copy=copy) # Try to avoid copy... ++ if np.lib.NumpyVersion(np.__version__) >= '2.0.0b1': ++ out = np.array(x, dtype=dtype, copy=(True if copy else None)) ++ else: ++ out = np.array(x, dtype=dtype, copy=copy) + + # Since we don't have a great way to check if these are using the same + # memory location, we will probe manually (ugh).