3434from rez .vendor .distlib .scripts import ScriptMaker # noqa: E402
3535
3636
37- def create_virtual_environment (dest_dir : str ) -> None :
37+ def create_virtual_environment (dest_dir : str , python_symlinks = True ) -> None :
3838 """Create a virtual environment in the given directory.
3939
4040 Args:
@@ -51,7 +51,7 @@ def create_virtual_environment(dest_dir: str) -> None:
5151 print (f"Failed to create virtual environment: { err } " )
5252 sys .exit (1 )
5353 else :
54- builder = venv .EnvBuilder (with_pip = True )
54+ builder = venv .EnvBuilder (with_pip = True , symlinks = python_symlinks )
5555 builder .create (dest_dir )
5656
5757
@@ -147,7 +147,7 @@ def copy_completion_scripts(dest_dir):
147147 return None
148148
149149
150- def install (dest_dir , print_welcome = False , editable = False ):
150+ def install (dest_dir , print_welcome = False , editable = False , python_symlinks = False ):
151151 """Install rez into the given directory.
152152
153153 Args:
@@ -156,7 +156,7 @@ def install(dest_dir, print_welcome=False, editable=False):
156156 print ("installing rez%s to %s..." % (" (editable mode)" if editable else "" , dest_dir ))
157157
158158 # create the virtualenv
159- create_virtual_environment (dest_dir )
159+ create_virtual_environment (dest_dir , python_symlinks )
160160
161161 # install rez from source
162162 install_rez_from_source (dest_dir , editable = editable )
@@ -289,6 +289,10 @@ def install_as_rez_package(repo_path):
289289 help = "Make the install an editable install (pip install -e). This should "
290290 "only be used for development purposes"
291291 )
292+ parser .add_argument ("-ps" , "--keep-python-symlinks" , action = "store_true" ,
293+ default = False , help = "Allow symlinks in python installation. This might "
294+ "help with python distribution that use relative links like ie. UV."
295+ )
292296 parser .add_argument (
293297 "DIR" , nargs = '?' ,
294298 help = "Destination directory. If '{version}' is present, it will be "
@@ -323,4 +327,7 @@ def install_as_rez_package(repo_path):
323327 if opts .as_rez_package :
324328 install_as_rez_package (dest_dir )
325329 else :
326- install (dest_dir , print_welcome = True , editable = opts .editable )
330+ install (
331+ dest_dir , print_welcome = True , editable = opts .editable ,
332+ python_symlinks = opts .keep_python_symlinks
333+ )
0 commit comments