Commits

Garth Johnson  committed bf42ece

Fixed installer logic error for existing python environments and on initial run of software.

  • Participants
  • Parent commits 04442a4

Comments (0)

Files changed (2)

File djaboto/management/commands/checkmix.py

     ## Manage the virtual python freshness. New socks or old smelly ones
     # today...?
     DIR_PYTHON = os.path.realpath(args.python)
-    if not args.existingpve:
-        djaboto.pve.install_pve(DIR_PYTHON)
-    else:
-        print '...using %s as-is.  Warning, this may leave some modules outdated.' % DIR_PYTHON
+    djaboto.pve.install_pve(DIR_PYTHON, args.existingpve)
     djaboto.pve.activate(DIR_PYTHON)
     if not args.existingpve:
         djaboto.pve.install_pve_base(DIR_CACHE)

File djaboto/pve.py

 from shutil import rmtree
 
 
-def install_pve(pve_dir):
+def install_pve(pve_dir, leave_existing=True):
     """
     Install a fresh Python Virtual Environment
     """
 
     if os.path.isdir(pve_dir):
-        print '  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING'
-        print 'Are you ABSOLUTELY sure you wish to remove your current Python virtual environment?'
-        print 'Located at: %s' % pve_dir
-        pve_continue = raw_input('(yes/no) ')
-        if pve_continue == "yes":
+        if leave_existing:
+            print "...leaving environment as is!"
+        else:
             print '...removing %s and installing a fresh Python virtual environment' % pve_dir
             rmtree(pve_dir)
             check_call(['virtualenv', pve_dir])
-        else:
-            print "...leaving environment as is!"
     else:
         print '...installing Python virtual environment in %s ' % pve_dir
+        check_call(['virtualenv', pve_dir])
 
 def activate(pve_dir):
     activate_this = os.path.join(pve_dir, "bin", "activate_this.py")