コード例 #1
0
    # fetch version of the toolbox
    print 'Fetch version of the toolbox... '
    with open (path_sct+"/version.txt", "r") as myfile:
        version_sct = Version(myfile.read().replace('\n', ''))
    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.failed("You can't install a patch that is an oldest version than the one you have.")
        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
    files = [os.path.join(dp, f) for dp, dn, filenames in os.walk('.') for f in filenames]

    # copy files one by one (to inform user)
コード例 #2
0
Install Spinal Cord Toolbox patch in $SCT_DIR

USAGE
""" + os.path.basename(__file__) + """ -p <path>

MANDATORY ARGUMENTS
-a                          allow for non-admin installation
-h                          display this help
  """

    # exit program
    sys.exit(2)


#=======================================================================================================================
# Start program
#=======================================================================================================================
if __name__ == "__main__":
    # call main function
    try:
        main()
    except InstallFailed, e:
        MsgUser.failed(e.value)
        exit(1)
    except UnsupportedOs, e:
        MsgUser.failed(e.value)
        exit(1)
    except KeyboardInterrupt, e:
        MsgUser.failed("Install aborted by the user.")
        exit(1)
コード例 #3
0
    # fetch version of the toolbox
    print "Fetch version of the toolbox... "
    with open(path_sct + "/version.txt", "r") as myfile:
        version_sct = Version(myfile.read().replace("\n", ""))
    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)
コード例 #4
0
Install Spinal Cord Toolbox patch in $SCT_DIR

USAGE
""" + os.path.basename(__file__) + """ -p <path>

MANDATORY ARGUMENTS
-a                          allow for non-admin installation
-h                          display this help
  """

    # exit program
    sys.exit(2)


#=======================================================================================================================
# Start program
#=======================================================================================================================
if __name__ == "__main__":
    # call main function
    try:
        main()
    except InstallFailed, e:
        MsgUser.failed(e.value)
        exit(1)
    except UnsupportedOs, e:
        MsgUser.failed(e.value)
        exit(1)
    except KeyboardInterrupt, e:
        MsgUser.failed("Install aborted by the user.")
        exit(1)