Disable virtualenv and venv in the environment.
173826
def _disable_venv(self, env):
        
        venv = env.pop('VIRTUAL_ENV', None)
        if venv:
            venv_path, sep, env['PATH'] = env['PATH'].partition(os.pathsep)
750527
def _exclude_paths_from_environ(env_prefix=''):
    """"""
    paths = os.environ.get(env_prefix + 'WSGI_AUTH_EXCLUDE_PATHS')
    if not paths:
        return []
    return paths.split(';')
1016118
def get_environ(environ, defaults, ve_path):
    
    # Copy the parent environment, add in defaults from .vexrc.
    env = environ.copy()
    env.update(defaults)

    # Leaving in existing PYTHONHOME can cause some errors
    if 'PYTHONHOME' in env:
        del env['PYTHONHOME']

    # Now we have to adjust PATH to find scripts for the virtualenv...
    # PATH being unset/empty is OK, but ve_path must be set
    # or there is nothing for us to do here and it's bad.
    if not ve_path:
        raise exceptions.BadConfig('ve_path must be set')
    if platform.system() == 'Windows':
        ve_bin = os.path.join(ve_path, 'Scripts')
    else:
        ve_bin = os.path.join(ve_path, 'bin')

    # If user is currently in a virtualenv, DON'T just prepend
    # to its path (vex foo; echo $PATH -> " /foo/bin:/bar/bin")
    # but don't incur this cost unless we're already in one.
    # activate handles this by running 'deactivate' first, we don't
    # have that so we have to use other ways.
    # This would not be necessary and things would be simpler if vex
    # did not have to interoperate with a ubiquitous existing tool.
    # virtualenv doesn't...
    current_ve = env.get('VIRTUAL_ENV', '')
    system_path = environ.get('PATH', '')
    segments = system_path.split(os.pathsep)
    if current_ve:
        # Since activate doesn't export _OLD_VIRTUAL_PATH, we are going to
        # manually remove the virtualenv's bin.
        # A virtualenv's bin should not normally be on PATH except
        # via activate or similar, so I'm OK with this solution.
        current_ve_bin = os.path.join(current_ve, 'bin')
        try:
            segments.remove(current_ve_bin)
        except ValueError:
            raise exceptions.BadConfig(
                "something set VIRTUAL_ENV prior to this vex execution, "
                "implying that a virtualenv is already activated "
                "and PATH should contain the virtualenv's bin directory. "
                "Unfortunately, it doesn't: it's {0!r}. "
                "You might want to check that PATH is not "
                "getting clobbered somewhere, e.g. in your shell's configs."
                .format(system_path)
            )

    segments.insert(0, ve_bin)
    env['PATH'] = os.pathsep.join(segments)
    env['VIRTUAL_ENV'] = ve_path
    return env
1150390
def change_env(name, val):
    
    oldval = os.environ.get(name, None)
    os.environ[name] = val
    yield
    if oldval is None:
        del os.environ[name]
    else:
        os.environ[name] = oldval
348325
def disable():
        """"""
        if os.name != 'nt' or not Windows.is_enabled():
            return False

        getattr(sys.stderr, '_reset_colors', lambda: False)()
        getattr(sys.stdout, '_reset_colors', lambda: False)()

        if isinstance(sys.stderr, _WindowsStream):
            sys.stderr = getattr(sys.stderr, 'original_stream')
        if isinstance(sys.stderr, _WindowsStream):
            sys.stdout = getattr(sys.stdout, 'original_stream')

        return True
608887
def disable_site_packages():
    
    for entry in sys.path[:]:
        if 'site-packages' in entry or 'Extras' in entry:
            sys.path.remove(entry)
418300
def delete_environment(self, environment_ids):
        
        uri = 'api/v3/environment/%s/' % environment_ids

        return super(ApiEnvironment, self).delete(uri)
1024415
def init():
    """"""
    print(yellow("# Setting up development environment...\n", True))
    virtualenv.init()
    virtualenv.update()
    print(green("\n# DONE.", True))
    print(green("Type ") + green("activate", True) + green(" to enable your dev virtual environment."))
893639
def disable(name, **kwargs):
    '''
    
    '''
    if _service_is_upstart(name):
        return _upstart_disable(name)
    executable = _get_service_exec()
    cmd = [executable, '-f', name, 'remove']
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
1090464
def _trim_env_off_path(paths, saltenv, trim_slash=False):
    '''
    
    '''
    env_len = None if _is_env_per_bucket() else len(saltenv) + 1
    slash_len = -1 if trim_slash else None

    return [d[env_len:slash_len] for d in paths]
341476
def remove(self):
        '''
        
        '''
        print 'remove'
        if self.exists():
            print 'cleaning', self.venv
            run('rm -rf {}'.format(self.venv))
59066
def venv():
    """"""
    try:
        import virtualenv  # NOQA
    except ImportError:
        sh("%s -m pip install virtualenv" % PYTHON)
    if not os.path.isdir("venv"):
        sh("%s -m virtualenv venv" % PYTHON)
    sh("venv\\Scripts\\pip install -r %s" % (REQUIREMENTS_TXT))
755764
def without_rbenv(&block)
      previous_environment = ENV.select { |k,v| k =~ /\A(RBENV\_)/ }
      if previous_environment.size > 0
        previous_environment.each { |key, value| ENV[key] = nil }
        previous_environment['PATH'] = ENV['PATH']
        ENV['PATH'] = ENV['PATH'].split(':').select { |p| !(p =~ /\.rbenv\/versions/) }.join(':')
      end
      yield
    ensure
      previous_environment.each do |key, value|
        ENV[key] = value
      end
    end
1121707
def switch_or_run(cmd, venv_name=None):
    """"""
    if cmd:
        return _run(venv_name, cmd)
    inenv = InenvManager()
    if not os.getenv(INENV_ENV_VAR):
        activator_warn(inenv)
        return
    else:
        venv = inenv.get_prepped_venv(venv_name)
        inenv.clear_extra_source_file()
        inenv.write_extra_source_file("source {}".format(venv.activate_shell_file))
        inenv.write_extra_source_file(override_envars_and_deactivate(inenv.get_envvars(venv_name)))
        if autojump_enabled():
            directory = inenv.guess_contents_dir(venv_name)
            inenv.write_extra_source_file('cd {}'.format(directory))
            click.secho("Jumping to {}".format(directory), fg='green')
        sys.exit(EVAL_EXIT_CODE)
1008410
def uninstall(self):
        """"""
        if path.isdir(self.env_bin):
            self.remove_links()
        if path.isdir(self.env):
            print_pretty("<FG_BLUE>Removing env {}...<END>".format(self.env))
            shutil.rmtree(self.env)
1269129
def cleanup_files_on_ev3():
    """"""

    list = get_base_ev3dev_cmd() + ['cleanup']

    env = os.environ.copy()
    env["PYTHONUSERBASE"] = THONNY_USER_BASE
    proc = subprocess.Popen(list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                            universal_newlines=True, env=env)
    dlg = MySubprocessDialog(get_workbench(), proc, "Delete files in homedir on EV3", autoclose=False)
    dlg.wait_window()
686108
def clean_env(uchroot_cmd, varnames):
    """"""
    env = uchroot_cmd["/usr/bin/env"]
    __clean_env = env["-u", ",".join(varnames)]
    return __clean_env