# fetch version of the toolbox print 'Fetch version of the toolbox... ' with open(os.path.join(path_sct, "spinalcordtoolbox", "version.txt"), "r") as myfile: version_sct = Version(myfile.read().rstrip()) print " toolbox version: "+str(version_sct) # fetch version of the patch print 'Fetch version of the patch... ' with open("spinalcordtoolbox/version.txt", "r") as myfile: version_patch = Version(myfile.read().rstrip()) print " patch version: "+str(version_patch) # if patch is not compatible with this release, send message and quit. print 'Check compatibility... ' if version_sct >= version_patch: MsgUser.warning("This patch is not newer than the current version. Are you sure you want to install it?") install_new = "" signal.alarm(120) while install_new not in ["yes", "no"]: install_new = input_timeout("[yes|no]: ") signal.alarm(0) if install_new == "no": sys.exit(2) elif not version_sct.isEqualTo_MajorMinor(version_patch): print " ERROR: Patch is not compatible with this release. Patch version X.Y.Z should correspond to release" \ " version X.Y. Exit program.\n" sys.exit(2) else: print " OK" # list all files in patch
print " toolbox version: " + str(version_sct) # fetch version of the patch print "Fetch version of the patch... " with open("version.txt", "r") as myfile: version_patch = Version(myfile.read().replace("\n", "")) print " patch version: " + str(version_patch) # if patch is not compatible with this release, send message and quit. print "Check compatibility... " if version_sct == version_patch: MsgUser.failed("You already have installed this patch.") sys.exit(2) elif version_sct > version_patch: MsgUser.warning( "You can't install a patch that is an oldest version than the one you have. Installing this patch can broke the SCToolbox stability. Are you sure you want to install it?" ) install_new = "" signal.alarm(120) while install_new not in ["yes", "no"]: install_new = input_timeout("[yes|no]: ") signal.alarm(0) if install_new == "no": sys.exit(2) elif not version_sct.isEqualTo_MajorMinor(version_patch): print " ERROR: Patch is not compatible with this release. Patch version X.Y.Z should correspond to release" " version X.Y. Exit program.\n" sys.exit(2) else: print " OK" # list all files in patch
# fetch version of the toolbox print 'Fetch version of the toolbox... ' with open(os.path.join(path_sct, "version.txt"), "r") as myfile: version_sct = Version(myfile.read().rstrip()) print " toolbox version: "+str(version_sct) # fetch version of the patch print 'Fetch version of the patch... ' with open("version.txt", "r") as myfile: version_patch = Version(myfile.read().rstrip()) print " patch version: "+str(version_patch) # if patch is not compatible with this release, send message and quit. print 'Check compatibility... ' if version_sct >= version_patch: MsgUser.warning("This patch is not newer than the current version. Are you sure you want to install it?") install_new = "" signal.alarm(120) while install_new not in ["yes", "no"]: install_new = input_timeout("[yes|no]: ") signal.alarm(0) if install_new == "no": sys.exit(2) elif not version_sct.isEqualTo_MajorMinor(version_patch): print " ERROR: Patch is not compatible with this release. Patch version X.Y.Z should correspond to release" \ " version X.Y. Exit program.\n" sys.exit(2) else: print " OK" # list all files in patch