Skip to content
Open
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
17 changes: 12 additions & 5 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from rez.vendor.distlib.scripts import ScriptMaker # noqa: E402


def create_virtual_environment(dest_dir: str) -> None:
def create_virtual_environment(dest_dir: str, python_symlinks=True) -> None:
"""Create a virtual environment in the given directory.

Args:
Expand All @@ -51,7 +51,7 @@ def create_virtual_environment(dest_dir: str) -> None:
print(f"Failed to create virtual environment: {err}")
sys.exit(1)
else:
builder = venv.EnvBuilder(with_pip=True)
builder = venv.EnvBuilder(with_pip=True, symlinks=python_symlinks)
builder.create(dest_dir)


Expand Down Expand Up @@ -147,7 +147,7 @@ def copy_completion_scripts(dest_dir):
return None


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

Args:
Expand All @@ -156,7 +156,7 @@ def install(dest_dir, print_welcome=False, editable=False):
print("installing rez%s to %s..." % (" (editable mode)" if editable else "", dest_dir))

# create the virtualenv
create_virtual_environment(dest_dir)
create_virtual_environment(dest_dir, python_symlinks)

# install rez from source
install_rez_from_source(dest_dir, editable=editable)
Expand Down Expand Up @@ -289,6 +289,10 @@ def install_as_rez_package(repo_path):
help="Make the install an editable install (pip install -e). This should "
"only be used for development purposes"
)
parser.add_argument("-ps", "--keep-python-symlinks", action="store_true",
default=False, help="Allow symlinks in python installation. This might "
"help with python distribution that use relative links like ie. UV."
)
parser.add_argument(
"DIR", nargs='?',
help="Destination directory. If '{version}' is present, it will be "
Expand Down Expand Up @@ -323,4 +327,7 @@ 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, editable=opts.editable)
install(
dest_dir, print_welcome=True, editable=opts.editable,
python_symlinks=opts.keep_python_symlinks
)