Ejemplo n.º 1
0
def install(dest_dir, print_welcome=False):
    """Install rez into the given directory.

    Args:
        dest_dir (str): Full path to the install directory.
    """
    print("installing rez to %s..." % dest_dir)

    # create the virtualenv
    create_environment(dest_dir)

    # install rez from source
    install_rez_from_source(dest_dir)

    # patch the rez binaries
    patch_rez_binaries(dest_dir)

    # copy completion scripts into venv
    completion_path = copy_completion_scripts(dest_dir)

    # mark venv as production rez install. Do not remove - rez uses this!
    _, _, _, venv_bin_dir = path_locations(dest_dir)
    dest_bin_dir = os.path.join(venv_bin_dir, "rez")
    validation_file = os.path.join(dest_bin_dir, ".rez_production_install")
    with open(validation_file, 'w') as f:
        f.write(_rez_version)

    # done
    if print_welcome:
        print()
        print("SUCCESS! To activate Rez, add the following path to $PATH:")
        print(dest_bin_dir)

        if completion_path:
            print('')
            shell = os.getenv('SHELL')

            if shell:
                shell = os.path.basename(shell)
                ext = "csh" if "csh" in shell else "sh"  # Basic selection logic

                print(
                    "You may also want to source the completion script (for %s):"
                    % shell)
                print("source {0}/complete.{1}".format(completion_path, ext))
            else:
                print(
                    "You may also want to source the relevant completion script from:"
                )
                print(completion_path)

        print('')
Ejemplo n.º 2
0
    # determine install path
    if len(args) != 1:
        parser.error("expected DEST_DIR")

    dest_dir = args[0].format(version=_rez_version)
    dest_dir = os.path.expanduser(dest_dir)
    dest_dir = os.path.realpath(dest_dir)

    print "installing rez to %s..." % dest_dir

    # make virtualenv verbose
    log_level = Logger.level_for_integer(2 - opts.verbose)
    logger = Logger([(log_level, sys.stdout)])

    # create the virtualenv
    create_environment(dest_dir)

    # install rez from source
    _, _, _, venv_bin_dir = path_locations(dest_dir)
    py_executable = which("python",
                          env={
                              "PATH": venv_bin_dir,
                              "PATHEXT": os.environ.get("PATHEXT", "")
                          })
    args = [
        py_executable, "setup.py", "install", "--quiet",
        "--single-version-externally-managed", "--record",
        os.path.join(dest_dir, 'install_log.txt')
    ]
    if opts.verbose:
        print "running in %s: %s" % (source_path, " ".join(args))
Ejemplo n.º 3
0
def install(dest_dir, print_welcome=False):
    """Install rez into the given directory.

    Args:
        dest_dir (str): Full path to the install directory.
    """
    print("installing rez to %s..." % dest_dir)

    # create the virtualenv
    create_environment(dest_dir)

    # install rez from source
    install_rez_from_source(dest_dir)

    # patch the rez binaries
    patch_rez_binaries(dest_dir)

    # copy completion scripts into venv
    completion_path = copy_completion_scripts(dest_dir)

    # mark venv as production rez install. Do not remove - rez uses this!
    _, _, _, venv_bin_dir = path_locations(dest_dir)
    dest_bin_dir = os.path.join(venv_bin_dir, "rez")
    validation_file = os.path.join(dest_bin_dir, ".rez_production_install")
    with open(validation_file, 'w') as f:
        f.write(_rez_version)

    # done
    if print_welcome:
        print()
        print("SUCCESS!")
        rez_exe = os.path.realpath(os.path.join(dest_bin_dir, "rez"))
        print("Rez executable installed to: %s" % rez_exe)

        try:
            out = subprocess.check_output([
                rez_exe,
                "python",
                "-c",
                "import rez; print(rez.__path__[0])"
            ])
            pkg_path = os.path.realpath(out.strip())
            print("Rez python package installed to: %s" % pkg_path)
        except:
            pass  # just in case there's an issue with rez-python tool

        print()
        print("To activate Rez, add the following path to $PATH:")
        print(dest_bin_dir)

        if completion_path:
            print('')
            shell = os.getenv('SHELL')

            if shell:
                shell = os.path.basename(shell)
                ext = "csh" if "csh" in shell else "sh"  # Basic selection logic

                print("You may also want to source the completion script (for %s):" % shell)
                print("source {0}/complete.{1}".format(completion_path, ext))
            else:
                print("You may also want to source the relevant completion script from:")
                print(completion_path)

        print('')
Ejemplo n.º 4
0
def create_virtual_environment(dest_dir):
    if use_venv:
        builder = venv.EnvBuilder(with_pip=True)
        builder.create(dest_dir)
    else:
        create_environment(dest_dir)
Ejemplo n.º 5
0
    # determine install path
    if len(args) != 1:
        parser.error("expected DEST_DIR")

    dest_dir = args[0].format(version=_rez_version)
    dest_dir = os.path.expanduser(dest_dir)
    dest_dir = os.path.realpath(dest_dir)

    print "installing rez to %s..." % dest_dir

    # make virtualenv verbose
    log_level = Logger.level_for_integer(2 - opts.verbose)
    logger = Logger([(log_level, sys.stdout)])

    # create the virtualenv
    create_environment(dest_dir)

    # install rez from source
    _, _, _, venv_bin_dir = path_locations(dest_dir)
    py_executable = which("python", env={"PATH":venv_bin_dir,
                                         "PATHEXT":os.environ.get("PATHEXT",
                                                                  "")})
    args = [
        py_executable, "setup.py", "install", "--quiet",
        "--single-version-externally-managed", "--record", os.path.join(dest_dir, 'install_log.txt')]
    if opts.verbose:
        print "running in %s: %s" % (source_path, " ".join(args))
    p = subprocess.Popen(args, cwd=source_path)
    p.wait()

    # patch the rez binaries