Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -e/--editable flag to install script to create an editable install #1672

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,19 @@ def copy_completion_scripts(dest_dir):
return None


def install(dest_dir, print_welcome=False):
def install(dest_dir, print_welcome=False, editable=False):
"""Install rez into the given directory.

Args:
dest_dir (str): Full path to the install directory.
"""
print("installing rez to %s..." % dest_dir)
print("installing rez%s to %s..." % (" (editable mode)" if editable else "", dest_dir))

# create the virtualenv
create_virtual_environment(dest_dir)

# install rez from source
install_rez_from_source(dest_dir)
install_rez_from_source(dest_dir, editable=editable)

# patch the rez binaries
patch_rez_binaries(dest_dir)
Expand Down Expand Up @@ -222,11 +222,15 @@ def install(dest_dir, print_welcome=False):
print('')


def install_rez_from_source(dest_dir):
def install_rez_from_source(dest_dir, editable):
_, py_executable = get_virtualenv_py_executable(dest_dir)

# install via pip
run_command([py_executable, "-m", "pip", "install", "."])
args = [py_executable, "-m", "pip", "install"]
if editable:
args.append("-e")
args.append(".")
run_command(args)


def install_as_rez_package(repo_path):
Expand Down Expand Up @@ -280,6 +284,11 @@ def install_as_rez_package(repo_path):
help="Install rez as a rez package. Note that this installs the API "
"only (no cli tools), and DIR is expected to be the path to a rez "
"package repository (and will default to ~/packages instead).")
parser.add_argument(
"-e", "--editable", action="store_true",
help="Make the install an editable install (pip install -e). This should "
"only be used for development purposes"
)
parser.add_argument(
"DIR", nargs='?',
help="Destination directory. If '{version}' is present, it will be "
Expand Down Expand Up @@ -314,4 +323,4 @@ def install_as_rez_package(repo_path):
if opts.as_rez_package:
install_as_rez_package(dest_dir)
else:
install(dest_dir, print_welcome=True)
install(dest_dir, print_welcome=True, editable=opts.editable)