Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkQuadrilateralCell.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ QuadrilateralCell<TCellInterface>::EvaluatePosition(CoordinateType * x,
// set initial position for Newton's method
int subId = 0;

double params[CellDimension] = { 0.5, 0.5 };
double params[CellDimension] = { 0.5, 0.5 };
CoordinateType pcoords[CellDimension] = { 0.5, 0.5 };

// NOTE: Point x is here assumed to lie on the plane of Quad. Otherwise, (FIXME)
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkSymmetricEigenAnalysis.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ SymmetricEigenAnalysis<TMatrix, TVector, TEigenMatrix>::ComputeEigenValuesUsingQ
p = d[m];
double c = 1.;
double c2 = c;
double const el1 = e[l + 1];
const double el1 = e[l + 1];
double s = 0.;
double s2 = 0;
double c3 = c2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ParameterizationQuadEdgeMeshFilter<TInputMesh, TOutputMesh, TSolverTraits>::Fill
if (it != m_BoundaryPtMap.end())
{
InputCoordinateType value = (*m_CoefficientsMethod)(input, temp);
OutputPointType pt2 = output->GetPoint(it->first);
OutputPointType pt2 = output->GetPoint(it->first);
SolverTraits::AddToMatrix(iM, InternalId1, InternalId1, value);
k[0] += static_cast<ValueType>(pt2[0] * value);
k[1] += static_cast<ValueType>(pt2[1] * value);
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ JPEG2000ImageIO::Read(void * buffer)
OPJ_UINT32 l_data_size;

OPJ_UINT32 l_nb_comps;
OPJ_BOOL tileHeaderRead = opj_read_tile_header(this->m_Internal->m_Dinfo,
OPJ_BOOL tileHeaderRead = opj_read_tile_header(this->m_Internal->m_Dinfo,
l_stream,
&l_tile_index,
&l_data_size,
Expand Down
51 changes: 13 additions & 38 deletions Utilities/GitSetup/setup-precommit
Original file line number Diff line number Diff line change
@@ -1,55 +1,30 @@
#!/usr/bin/env bash

MIN_PYTHON_VERSION_MAJOR=3
MIN_PYTHON_VERSION_MINOR=8
MIN_PRECOMMIT_VERSION=3.5.0

die() {
echo 1>&2 "$@" ; exit 1
}

# Make sure we are inside the repository.
cd "${BASH_SOURCE%/*}" &&

# check if python executable exists and is at least MIN_PYTHON_VERSION
if ! command -v python3 &> /dev/null; then
die "Python $MIN_PYTHON_VERSION or later is required for pre-commit."
fi &&
exe_ext=""
if [[ "$(uname -o)" == "Msys" ]]; then
exe_ext=".exe"
fi

# get python major version and minor version into array
python_version=$(python3 --version | cut -d ' ' -f 2) &&
declare -a python_version_arr &&
python_version_arr=(`echo ${python_version//./ }`) &&
if test ${python_version_arr[0]} -lt $MIN_PYTHON_VERSION_MAJOR; then
die "Python $MIN_PYTHON_VERSION_MAJOR or later is required for pre-commit."
elif test ${python_version_arr[0]} -eq $MIN_PYTHON_VERSION_MAJOR; then
if test ${python_version_arr[1]} -lt $MIN_PYTHON_VERSION_MINOR; then
die "Python $MIN_PYTHON_VERSION_MAJOR.$MIN_PYTHON_VERSION_MINOR or later is for pre-commit"
fi
# check if curl executable exists
if ! command -v curl &> /dev/null; then
die "curl is required."
fi &&
echo "Python version is $python_version" &&
git_dir=$(git rev-parse --git-dir) &&
mkdir -p "$git_dir/hooks" &&
(
cd "$git_dir/hooks" &&
# remove venv if python version is different
if [ -d venv ]; then
source venv/bin/activate &&
python_version_venv=$(python --version | cut -d ' ' -f 2) &&
if [ "$python_version" != "$python_version_venv" ]; then
deactivate &&
rm -rf venv
fi
pixi_exe=$git_dir/hooks/pixi/bin/pixi$exe_ext &&
if [[ -f "$pixi_exe" ]]; then
$pixi_exe run pre-commit-install
exit $?
fi &&
if [ ! -d venv ]; then
echo "Setting up python venv..." &&
python3 -m venv venv
fi
) &&
# activate the venv and install pre-commit with the min version in subshell
(
echo "Setting up pre-commit..." &&
source ${git_dir}/hooks/venv/bin/activate &&
python -m pip install --disable-pip-version-check -q -U "pre-commit>=$MIN_PRECOMMIT_VERSION" &&
pre-commit install -f -t pre-commit -t prepare-commit-msg -t commit-msg
curl -fsSL https://pixi.sh/install.sh | PIXI_HOME=$git_dir/hooks/pixi PIXI_NO_PATH_UPDATE=1 bash &&
$pixi_exe run pre-commit-install
)
2 changes: 1 addition & 1 deletion Utilities/SetupForDevelopment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ echo -e "Git version $git_version is OK.\n"
echo 'Failed to setup pre-commit.') && echo &&

# Record the version of this setup so Hooks/pre-commit can check it.
SetupForDevelopment_VERSION=10
SetupForDevelopment_VERSION=11
git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION}
1,401 changes: 1,386 additions & 15 deletions pixi.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ clean = { cmd = "git clean -fdx", description = "Clean the repository" }
[tool.pixi.dependencies]
python = ">=3.12.0,<3.13"

[tool.pixi.feature.pre-commit.dependencies]
pre-commit = ">=4.0.1,<5"

[tool.pixi.feature.pre-commit.tasks]
pre-commit-install = { cmd = "pre-commit install -f -t pre-commit -t prepare-commit-msg -t commit-msg", description = "Install pre-commit hooks" }
pre-commit-run = { cmd = "pre-commit run --all", description = "Run pre-commit hooks on all repository files" }

[tool.pixi.feature.dev.dependencies]
cmake = ">=3.30.2,<4"
cxx-compiler = ">=1.7.0,<2"
Expand Down Expand Up @@ -146,3 +153,4 @@ depends-on = ["build-debug-python"]
dev = ["dev"]
cxx = ["dev", "cxx"]
python = ["python", "dev"]
pre-commit = ["pre-commit"]