Skip to content

Commit

Permalink
Update to numpy2
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaarrfk committed Sep 2, 2024
1 parent 78c9e4d commit 30295aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
19 changes: 11 additions & 8 deletions ci/build_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@ conda create \
--name vigra \
python=${PYTHON_VERSION} pytest c-compiler cxx-compiler \
zlib libjpeg-turbo libpng libtiff hdf5 fftw \
boost boost-cpp "numpy<2" h5py sphinx \
boost boost-cpp numpy h5py sphinx \
openexr lemon cmake make ruff


if [[ `uname` == 'Darwin' ]];
then
if [[ `uname` == 'Darwin' ]]; then
export SHLIB_EXT=".dylib"
# I - hmaarrrfk - forget why the definition of LDFLAGS here is necessary
export LDFLAGS="-undefined dynamic_lookup ${LDFLAGS}"
else
export SHLIB_EXT=".so"
fi

# Set the variable CPU_COUNT to take on the default value of 2
export CPU_COUNT=${CPU_COUNT:-2}

source $CONDA/bin/activate vigra

# lint quickly to help find obvious mistakes
( cd vigranumpy && ruff check . )

mkdir build
cd build
mkdir -p build
pushd build

cmake .. \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
Expand All @@ -49,6 +51,7 @@ cmake .. \
-DPNG_PNG_INCLUDE_DIR=${CONDA_PREFIX}/include


make -j2
make check -j2
make -j${CPU_COUNT}
make check -j${CPU_COUNT}
ctest -V
popd
2 changes: 1 addition & 1 deletion ci/build_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ call conda create ^
--name vigra ^
python=%PYTHON_VERSION% pytest c-compiler cxx-compiler ^
zlib libjpeg-turbo libpng libtiff hdf5 fftw cmake ninja ^
boost boost-cpp "numpy<2" h5py sphinx ^
boost boost-cpp numpy h5py sphinx ^
openexr lemon

if errorlevel 1 exit 1
Expand Down
2 changes: 1 addition & 1 deletion config/FindVIGRANUMPY_DEPENDENCIES.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ IF(Python_Interpreter_FOUND)

######################################################################
#
# check if nosetests are installed
# check if pytest is installed
#
######################################################################
execute_process(COMMAND ${Python_EXECUTABLE} -c
Expand Down
4 changes: 2 additions & 2 deletions vigranumpy/lib/arraytypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,9 +1443,9 @@ def ptp(self, axis=None, out=None):
if type(axis) == str:
axis = self.axistags.index(axis)
if axis is None:
return self.transposeToOrder('C').view(numpy.ndarray).ptp(out=out)
return numpy.ptp(self.transposeToOrder('C').view(numpy.ndarray), out=out)
else:
res = self.view(numpy.ndarray).ptp(axis, out)
res = numpy.ptp(self.view(numpy.ndarray), axis=axis, out=out)
if out is None:
res = res.view(VigraArray)
res.axistags = self._copy_axistags()
Expand Down

0 comments on commit 30295aa

Please sign in to comment.