def makedirs_and_symlink_if_needed(workon_home): if not workon_home.exists() and own(workon_home): workon_home.mkdir(parents=True) link = expandpath('~/.virtualenvs') if os.name == 'posix' and 'WORKON_HOME' not in os.environ and \ 'XDG_DATA_HOME' not in os.environ and not link.exists(): link.symlink_to(str(workon_home)) return True else: return False
def makedirs_and_symlink_if_needed(workon_home): if not workon_home.exists() and own(workon_home): workon_home.mkdir(parents=True) link = expandpath('~/.virtualenvs') if os.name == 'posix' and 'WORKON_HOME' not in os.environ and \ 'XDG_DATA_HOME' not in os.environ and not link.exists(): try: workon_home.symlink_to(str(link)) except OSError as e: # FIXME on TravisCI, even if I check with `link.exists()`, this # exception can be raised and needs to be catched, maybe it's a race condition? if e.errno != 17: raise
def makedirs_and_symlink_if_needed(workon_home): if not workon_home.exists() and own(workon_home): workon_home.mkdir(parents=True) link = expandpath("~/.virtualenvs") if ( os.name == "posix" and "WORKON_HOME" not in os.environ and "XDG_DATA_HOME" not in os.environ and not link.exists() ): link.symlink_to(str(workon_home)) return True else: return False