Check if venv already exists.

According to the documentation, Python should do that already:

    If the target directory already exists an error will be raised, unless the
    --clear or --upgrade option was provided.

However that doesn't seem to be the case: http://bugs.python.org/issue23202

We do this by hand to make sure the user doesn't accidentally overwrite
something.

See #463.
This commit is contained in:
Florian Bruhin 2015-01-23 13:23:33 +01:00
parent b8c54b5f02
commit b2646cb5c0

View File

@ -164,6 +164,12 @@ def main():
sys.exit(1)
g_path = os.path.abspath(g_args.path)
if os.path.exists(g_args.path) and not (g_args.force or g_args.clear or
g_args.upgrade):
print("{} does already exist! Use --clear or "
"--upgrade.".format(g_path), file=sys.stderr)
sys.exit(1)
create_venv()
utils.print_title("Installing setuptools")