Skip to content
Closed
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
37 changes: 37 additions & 0 deletions Utilities/Maintenance/UpdateITKGitTagPythonSetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

program_name=$0

function usage {
echo "Usage: ${program_name} "
echo " param1 Setup.py file path"
exit 1
}

# Display usage
if [ ${#@} != 1 ]; then
usage
fi

filename=$1
Comment thread
jhlegarreta marked this conversation as resolved.

# Get the latest ITK git tag
latest_git_tag=$(curl -s "https://api.github.com/repos/InsightSoftwareConsortium/ITK/tags" | jq '.[0].name' )

# Strip the inverted commas
latest_git_tag=$(echo $latest_git_tag | tr -d '"')

# Strip the "v" prefix
latest_git_tag=${latest_git_tag:1}

git_install_req_tag_label='\install_requires=\['

# Read the ITK install requirement git tag information
git_install_req_tag_str=($(grep -A1 -P ${git_install_req_tag_label}$ $filename))
git_install_req_tag=${git_install_req_tag_str[1]}

git_install_req_tag_arr=($(echo $git_install_req_tag | tr "=" " "))
curr_git_tag=${git_install_req_tag_arr[-1]}

# Sed the tag in the CMake file
sed -i "s/${curr_git_tag}/${latest_git_tag}/g" $filename