コード例 #1
0
def remove(ver):
    """
    Uninstalls the specified version.
    """
    if ver == shared.current_version():
        shared.link_to("system")
    shutil.rmtree(shared.get_version_dir(ver))
コード例 #2
0
ファイル: install.py プロジェクト: Kevnz/nodevers
def install(ver, build_args):
    """
    This calls the correct functions in the correct
    order to install Node.
    It also handles exceptions.
    """
    if shared.version_exists(ver):
        sys.stderr.write("Error: %s is already installed\n" % ver)
        sys.exit(1)
    elif not shared.valid_version_string(ver):
        sys.stderr.write("Error: %s doesn't look like a valid version\n" % ver)
        sys.exit(2)
    try:
        nodesrc = install_helper.NodeSourceInstaller(ver,
                shared.get_version_dir(ver), build_args)
        sys.stdout.write("Downloading...\n")
        nodesrc.download()
        sys.stdout.write("Extracting...\n")
        nodesrc.extract()
        sys.stdout.write("Patching...\n")
        if len(shared.get_patches_list(ver)) == 0:
            sys.stdout.write("No patches found.\n")
        else:
            nodesrc.patch()
        sys.stdout.write("Configuring...\n")
        nodesrc.configure()
        sys.stdout.write("Building...\n")
        nodesrc.make()
        sys.stdout.write("Installing...\n")
        nodesrc.make_install()
    except StandardError:
        err = sys.exc_info()[1]
        sys.stderr.write("Error: %s\n" % str(err))
        sys.exit(2)
    finally:
        sys.stdout.write("Cleaning up...\n")
        try:
            nodesrc.cleanup()
        except StandardError:
            pass
コード例 #3
0
def install(ver, build_args):
    """
    This calls the correct functions in the correct
    order to install Node.
    It also handles exceptions.
    """
    if shared.version_exists(ver):
        sys.stderr.write("Error: %s is already installed\n" % ver)
        sys.exit(1)
    elif not shared.valid_version_string(ver):
        sys.stderr.write("Error: %s doesn't look like a valid version\n" % ver)
        sys.exit(2)
    try:
        nodesrc = install_helper.NodeSourceInstaller(
            ver, shared.get_version_dir(ver), build_args)
        sys.stdout.write("Downloading...\n")
        nodesrc.download()
        sys.stdout.write("Extracting...\n")
        nodesrc.extract()
        sys.stdout.write("Patching...\n")
        if len(shared.get_patches_list(ver)) == 0:
            sys.stdout.write("No patches found.\n")
        else:
            nodesrc.patch()
        sys.stdout.write("Configuring...\n")
        nodesrc.configure()
        sys.stdout.write("Building...\n")
        nodesrc.make()
        sys.stdout.write("Installing...\n")
        nodesrc.make_install()
    except StandardError:
        err = sys.exc_info()[1]
        sys.stderr.write("Error: %s\n" % str(err))
        sys.exit(2)
    finally:
        sys.stdout.write("Cleaning up...\n")
        try:
            nodesrc.cleanup()
        except StandardError:
            pass