From c000f0b9a92bdb663970dfa41baa01874b96f8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Fri, 29 Mar 2019 22:43:31 -0400 Subject: [PATCH] ENH: Update the Remote module Python package version automatically Update the Remote module Python package version to a new major version automatically when updating the required ITK version. --- .../UpdateRequiredITKVersionInFiles.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Utilities/Maintenance/UpdateRequiredITKVersionInFiles.sh b/Utilities/Maintenance/UpdateRequiredITKVersionInFiles.sh index dba3dd6194a..52409edf567 100755 --- a/Utilities/Maintenance/UpdateRequiredITKVersionInFiles.sh +++ b/Utilities/Maintenance/UpdateRequiredITKVersionInFiles.sh @@ -67,3 +67,27 @@ curr_git_tag=${git_install_req_tag_arr[-1]} # Sed the latest ITK git tag in the Python setup file sed -i "s/${curr_git_tag}/${latest_git_tag}/g" $python_setup_filename + +pckg_version_label='version' + +# Read the module Python package version tag information +pckg_version_tag_str=($(grep -A1 -P ${pckg_version_label} $filename)) + +# Strip the ending comma +pckg_version_tag_str=${pckg_version_tag_str::-1} + +pckg_version_tag_arr=($(echo $pckg_version_tag_str | tr "=" " ")) + +pckg_version=${pckg_version_tag_arr[1]} + +# Strip the inverted commas +pckg_version=$(echo $pckg_version | tr -d "\'") + +pckg_version_arr=($(echo $pckg_version | tr "." " ")) +pckg_major_version=${pckg_version_arr[0]} +new_pckg_major_version=$((pckg_major_version + 1)) + +# Update to a new major version +new_pckg_version="version='$new_pckg_major_version.0.0'" + +sed -i "s/${pckg_version_tag_str}/${new_pckg_version}/g" $filename