]> granicus.if.org Git - python/commitdiff
Closes #18435: Merged fix from 3.3.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 12 Jul 2013 20:13:01 +0000 (21:13 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 12 Jul 2013 20:13:01 +0000 (21:13 +0100)
1  2 
Lib/venv/__init__.py

index ecdb68e880817558f6b073fc8f65673039a4b8a4,272a887216e5a0edd41a7bbb85b007bf5d262928..4adde5f58e9ed5b490261c6935686117bdeeec8d
@@@ -111,12 -98,12 +106,12 @@@ class EnvBuilder
          def create_if_needed(d):
              if not os.path.exists(d):
                  os.makedirs(d)
 +            elif os.path.islink(d) or os.path.isfile(d):
 +                raise ValueError('Unable to create directory %r' % d)
  
 -        if os.path.exists(env_dir) and not (self.clear or self.upgrade):
 -            raise ValueError('Directory exists: %s' % env_dir)
          if os.path.exists(env_dir) and self.clear:
 -            shutil.rmtree(env_dir)
 +            self.clear_directory(env_dir)
-         context = Context()
+         context = types.SimpleNamespace()
          context.env_dir = env_dir
          context.env_name = os.path.split(env_dir)[1]
          context.prompt = '(%s) ' % context.env_name