def do_clone(self, arg): """Make a copy of the specified virtualenv""" root = self._getroot() active = _get_active_venv(root) if not active: print >> sys.stdout, "no active venv to clone" sys.exit(1) newvenv = _new_venv_path(root) try: clone.clone_virtualenv(active, newvenv) except Exception, e: if os.path.exists(newvenv): _rm_r(newvenv) print >> sys.stdout, "cloning active virtualenv failed" sys.exit(1)
def do_clone(self, arg): """Make a copy of the specified virtualenv""" root = self._getroot() active = _get_active_venv(root) if not active: print("no active venv to clone", file=sys.stdout) sys.exit(1) newvenv = _new_venv_path(root) try: clone.clone_virtualenv(active, newvenv) except Exception as e: if os.path.exists(newvenv): _rm_r(newvenv) print("cloning active virtualenv failed", file=sys.stdout) sys.exit(1) # Now rewrite the startup rc file write_startup_rc(newvenv) # ... and finally mark it as the active one _mark_venv_active(root, newvenv)