New submission from Barry A. Warsaw:

There is a subtle behavior difference between virtualenv and pyvenv.  When you 
create a venv with virtualenv, the symbolic links files <venv>/bin are 
relative, while they are absolute with pyvenv.  This means that virtual 
environments created with virtualenv can be relocated (modulo the #! lines of 
the script, but let's not worry about that for now), but virtual environments 
created with pyvenv cannot be relocated.

With pyvenv, you also have <venv>/lib64 pointing to an absolute path.

AFAICT, there's no good reason why the symlink targets must be absolute paths.  
Relative paths work just fine for virtualenv and they should work fine for 
pyvenv.

This patch changes the lib64 and <venv>/bin/* symlinks to be relative.  There 
should be no change when symlinks are disabled or are unavailable.

One remaining question is whether <venv>/bin/python itself should be relative.  
In virtualenv, even with something like `-p /usr/bin/python3.4` you still get a 
relative link.  <venv>/bin/python points outside of the venv, so the question 
is whether the $PATH-dependent behavior of virtualenv is worthwhile or not.  My 
patch does not change this symlink.

----------
assignee: vinay.sajip
components: Library (Lib)
files: venv.patch
keywords: patch
messages: 235457
nosy: barry, dstufft, vinay.sajip
priority: normal
severity: normal
stage: patch review
status: open
title: venv should create relative symlinks where possible
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file38023/venv.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23399>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to