cpython: c3c188a0325a (original) (raw)

Mercurial > cpython

changeset 79667:c3c188a0325a

Closes #15776: pyvenv now works with existing directories. [#15776]

Vinay Sajip <vinay_sajip@yahoo.co.uk>
date Thu, 11 Oct 2012 17:22:45 +0100
parents ad51ed93377c
children 2802b26c64a9
files Doc/library/venv.rst Lib/test/test_venv.py Lib/venv/__init__.py
diffstat 3 files changed, 74 insertions(+), 13 deletions(-)[+] [-] Doc/library/venv.rst 5 Lib/test/test_venv.py 59 Lib/venv/__init__.py 23

line wrap: on

line diff

--- a/Doc/library/venv.rst +++ b/Doc/library/venv.rst @@ -75,8 +75,8 @@ creation according to their needs, the : * system_site_packages -- a Boolean value indicating that the system Python site-packages should be available to the environment (defaults to False).

* symlinks -- a Boolean value indicating whether to attempt to symlink the Python binary (and any necessary DLLs or other binaries, @@ -88,7 +88,6 @@ creation according to their needs, the : upgraded in-place (defaults to False). - Creators of third-party virtual environment tools will be free to use the provided EnvBuilder class as a base class.

--- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -113,13 +113,68 @@ class BasicTest(BaseTest): out, err = p.communicate() self.assertEqual(out.strip(), expected.encode())

+

+ def test_overwrite_existing(self): """

+ builder = venv.EnvBuilder(clear=True) builder.create(self.env_dir)

+

+

def test_upgrade(self): """

--- a/Lib/venv/init.py +++ b/Lib/venv/init.py @@ -90,6 +90,14 @@ class EnvBuilder: self.setup_scripts(context) self.post_setup(context)

+ def ensure_directories(self, env_dir): """ Create the directories for the environment. @@ -101,11 +109,11 @@ class EnvBuilder: def create_if_needed(d): if not os.path.exists(d): os.makedirs(d)

@@ -369,11 +377,10 @@ def main(args=None): 'when symlinks are not the default for ' 'the platform.') parser.add_argument('--clear', default=False, action='store_true',