Execute finder script within the temporary venv context.
503197
def execute_finder(self, manager, package_name):
        
        filename = '{env_path}/results.json'.format(env_path=manager.env_path)
        subprocess.call([
            manager.venv_python, self._finder_path, package_name, filename
        ])

        # Load results into this context
        json_str = open(filename, 'r').read()
        return json.loads(json_str)
1209006
function exec (opts, cb) {
    var file, ctx;
    if (typeof opts === 'string') {
        file = opts;
        ctx = null;
        opts = {};
    } else {
        ctx = opts.ctx || null;
        file = opts.file;
    }

    // caching
    var ctxHash = ctx ? md5(ctx) : '';
    if (!opts.force && exec.cache[file] && exec.cache[file][ctxHash]) {
        process.nextTick(function () {
            cb(null, exec.cache[file][ctxHash]);
        });
        return;
    }

    load({file: file, force: opts.forceLoad}, function (err, content) {
        if (err) {
            cb(err);
            return;
        }

        var module = _assign({
            Vow     : VOW,
            console : console,
            require : require
        }, ctx);

        try {
            VM.runInNewContext(content, module, file + '.vm');
        } catch (e) {
            cb(e);
            return;
        }

        // caching
        exec.cache[file] = exec.cache[file] || {};
        exec.cache[file][ctxHash] = module;

        cb(null, module);
    });
}
1176390
def init(venv_name):
    """"""
    inenv = InenvManager()
    inenv.get_prepped_venv(venv_name, skip_cached=False)
    if not os.getenv(INENV_ENV_VAR):
        activator_warn(inenv)
    click.secho("Your venv is ready. Enjoy!", fg='green')
344102
def run(self, conn, tmp, module_name, module_args, inject):
        '''  '''

        if not self.runner.is_playbook:
            raise errors.AnsibleError("in current versions of ansible, templates are only usable in playbooks")

        # load up options
        options  = utils.parse_kv(module_args)
        source   = options.get('src', None)
        dest     = options.get('dest', None)

        if (source is None and 'first_available_file' not in inject) or dest is None:
            result = dict(failed=True, msg="src and dest are required")
            return ReturnData(conn=conn, comm_ok=False, result=result)

        # if we have first_available_file in our vars
        # look up the files and use the first one we find as src
        if 'first_available_file' in inject:
            found = False
            for fn in self.runner.module_vars.get('first_available_file'):
                fnt = utils.template(self.runner.basedir, fn, inject)
                fnd = utils.path_dwim(self.runner.basedir, fnt)
                if os.path.exists(fnd):
                    source = fnt
                    found = True
                    break
            if not found:
                result = dict(failed=True, msg="could not find src in first_available_file list")
                return ReturnData(conn=conn, comm_ok=False, result=result)
        else:
            source = utils.template(self.runner.basedir, source, inject)

        if dest.endswith("/"):
            base = os.path.basename(source)
            dest = os.path.join(dest, base)

        # template the source data locally & transfer
        try:
            resultant = utils.template_from_file(self.runner.basedir, source, inject)
        except Exception, e:
            result = dict(failed=True, msg=str(e))
            return ReturnData(conn=conn, comm_ok=False, result=result)

        xfered = self.runner._transfer_str(conn, tmp, 'source', resultant)
        # fix file permissions when the copy is done as a different user
        if self.runner.sudo and self.runner.sudo_user != 'root':
            self.runner._low_level_exec_command(conn, "chmod a+r %s" % xfered, 
                tmp)

        # run the copy module
        module_args = "%s src=%s dest=%s" % (module_args, xfered, dest)
        return self.runner._execute_module(conn, tmp, 'copy', module_args, inject=inject)
120100
def temporary_dir():
    
    d = tempfile.mkdtemp()
    try:
        with cd(d):
            yield d
    finally:
        if os.path.exists(d):
            shutil.rmtree(d)
230314
function execute() {
  var context = getDefaultContext();
  var compiledOutput = fs.readFileSync(this.outputPath)

  vm.runInContext(compiledOutput, context, this.outputPath);

  var module = extractModule(this.moduleName, context);

  this.compiledModule = context.Elm.fullscreen(module, this.defaults);
}
6151
def clean_virtualenv(self):
        
        self.user_run_script(
            script=scripts.get_script_path('clean_virtualenv.sh'),
            args=[],
            rw_venv=True,
            )
646523
def run(self):
        """"""
        super().run()
        call('rm -vrf ./build ./dist ./*.egg-info', shell=True)
        call('find . -name __pycache__ -type d | xargs rm -rf', shell=True)
        call('test -d docs && make -C docs/ clean', shell=True)
1111170
def run_script(self, filename=None, silent=False, set_focus=False,
                   args=None):
        """"""
        if filename is None:
            self.shell.interpreter.restore_stds()
            filename, _selfilter = getopenfilename(
                    self, _("Run Python script"), getcwd_or_home(),
                    _("Python scripts")+" (*.py ; *.pyw ; *.ipy)")
            self.shell.interpreter.redirect_stds()
            if filename:
                os.chdir( osp.dirname(filename) )
                filename = osp.basename(filename)
            else:
                return
        logger.debug("Running script with %s", args)
        filename = osp.abspath(filename)
        rbs = remove_backslashes
        command = "runfile('%s', args='%s')" % (rbs(filename), rbs(args))
        if set_focus:
            self.shell.setFocus()
        if self.dockwidget and not self.ismaximized:
            self.dockwidget.setVisible(True)
            self.dockwidget.raise_()
        self.shell.write(command+'\n')
        self.shell.run_command(command)
1369782
function runScriptViaModuleLoader(script, context) {
    if(!fs.existsSync(script.fullPath)) {
        events.emit('warn', 'Script file does\'t exist and will be skipped: ' + script.fullPath);
        return Q();
    }
    var scriptFn = require(script.fullPath);
    context.scriptLocation = script.fullPath;
    context.opts.plugin = script.plugin;

    // We can't run script if it is a plain Node script - it will run its commands when we require it.
    // This is not a desired case as we want to pass context, but added for compatibility.
    if (scriptFn instanceof Function) {
        // If hook is async it can return promise instance and we will handle it.
        return Q(scriptFn(context));
    } else {
        return Q();
    }
}
885954
def temp_path():
    """"""
    path = [p for p in sys.path]
    try:
        yield
    finally:
        sys.path = [p for p in path]
844110
def _get_activate_script(cmd, venv):
    
    # Suffix and source command for other shells.
    # Support for fish shell.
    if "fish" in cmd:
        suffix = ".fish"
        command = "source"
    # Support for csh shell.
    elif "csh" in cmd:
        suffix = ".csh"
        command = "source"
    else:
        suffix = ""
        command = "."
    # Escape any spaces located within the virtualenv path to allow
    # for proper activation.
    venv_location = str(venv).replace(" ", r"\ ")
    # The leading space can make history cleaner in some shells.
    return " {2} {0}/bin/activate{1}".format(venv_location, suffix, command)
161651
def run_file(path):
    """"""
    if PY26:
        dirpath, name, _ = splitname(path)
        found = imp.find_module(name, [dirpath])
        module = imp.load_module("__main__", *found)
        return vars(module)
    else:
        return runpy.run_path(path, run_name="__main__")
439373
def cache_script(script, text, opts={}):
    """"""
    global script_cache
    if script not in script_cache:
        update_script_cache(script, text, opts)
        pass
    return script
330043
def run(files, temp_folder):
    ""
    try:
        import frosted  # NOQA
    except ImportError:
        return NO_FROSTED_MSG

    py_files = filter_python_files(files)
    cmd = 'frosted {0}'.format(' '.join(py_files))

    return bash(cmd).value()
721861
def in_cmd(argv):
    """"""

    if len(argv) == 1:
        return workon_cmd(argv)

    parse_envname(argv, lambda : sys.exit('You must provide a valid virtualenv to target'))

    return inve(*argv)
22368
def restart_in_venv(venv, base, site_packages, args):
    
    if base and not os.path.isabs(venv) and not venv.startswith('~'):
        base = os.path.expanduser(base)
        # ensure we have an abs basepath at this point:
        #    a relative one makes no sense (or does it?)
        if os.path.isabs(base):
            venv = os.path.join(base, venv)

    if venv.startswith('~'):
        venv = os.path.expanduser(venv)

    if not os.path.exists(venv):
        try:
            import virtualenv
        except ImportError:
            print('The virtual environment does not exist: %s' % venv)
            print('and virtualenv is not installed, so a new environment cannot be created')
            sys.exit(3)
        print('Creating new virtualenv environment in %s' % venv)
        virtualenv.logger = logger
        logger.indent += 2
        virtualenv.create_environment(venv, site_packages=site_packages)
    if sys.platform == 'win32':
        python = os.path.join(venv, 'Scripts', 'python.exe')
        # check for bin directory which is used in buildouts
        if not os.path.exists(python):
            python = os.path.join(venv, 'bin', 'python.exe')
    else:
        python = os.path.join(venv, 'bin', 'python')
    if not os.path.exists(python):
        python = venv
    if not os.path.exists(python):
        raise BadCommand('Cannot find virtual environment interpreter at %s' % python)
    base = os.path.dirname(os.path.dirname(python))
    file = os.path.join(os.path.dirname(__file__), 'runner.py')
    if file.endswith('.pyc'):
        file = file[:-1]
    proc = subprocess.Popen(
        [python, file] + args + [base, '___VENV_RESTART___'])
    proc.wait()
    sys.exit(proc.returncode)