Function executed when running the script with the -install switch
903
def install():
    """"""
    # Create Spyder start menu folder
    # Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights
    # This is consistent with use of CSIDL_DESKTOPDIRECTORY below
    # CSIDL_COMMON_PROGRAMS =
    # C:\ProgramData\Microsoft\Windows\Start Menu\Programs
    # CSIDL_PROGRAMS =
    # C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
    start_menu = osp.join(get_special_folder_path('CSIDL_PROGRAMS'),
                          'Spyder (Py%i.%i %i bit)' % (sys.version_info[0],
                                                       sys.version_info[1],
                                                       struct.calcsize('P')*8))
    if not osp.isdir(start_menu):
        os.mkdir(start_menu)
        directory_created(start_menu)

    # Create Spyder start menu entries
    python = osp.abspath(osp.join(sys.prefix, 'python.exe'))
    pythonw = osp.abspath(osp.join(sys.prefix, 'pythonw.exe'))
    script = osp.abspath(osp.join(sys.prefix, 'scripts', 'spyder'))
    if not osp.exists(script): # if not installed to the site scripts dir
        script = osp.abspath(osp.join(osp.dirname(osp.abspath(__file__)), 'spyder'))
    workdir = "%HOMEDRIVE%%HOMEPATH%"
    import distutils.sysconfig
    lib_dir = distutils.sysconfig.get_python_lib(plat_specific=1)
    ico_dir = osp.join(lib_dir, 'spyder', 'windows')
    # if user is running -install manually then icons are in Scripts/
    if not osp.isdir(ico_dir):
        ico_dir = osp.dirname(osp.abspath(__file__))

    desc = 'The Scientific Python Development Environment'
    fname = osp.join(start_menu, 'Spyder (full).lnk')
    create_shortcut(python, desc, fname, '"%s"' % script, workdir,
                    osp.join(ico_dir, 'spyder.ico'))
    file_created(fname)

    fname = osp.join(start_menu, 'Spyder-Reset all settings.lnk')
    create_shortcut(python, 'Reset Spyder settings to defaults',
                    fname, '"%s" --reset' % script, workdir)
    file_created(fname)

    current = True  # only affects current user
    root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
    winreg.SetValueEx(winreg.CreateKey(root, KEY_C1 % ("", EWS)),
                      "", 0, winreg.REG_SZ,
                      '"%s" "%s\Scripts\spyder" "%%1"' % (pythonw, sys.prefix))
    winreg.SetValueEx(winreg.CreateKey(root, KEY_C1 % ("NoCon", EWS)),
                      "", 0, winreg.REG_SZ,
                      '"%s" "%s\Scripts\spyder" "%%1"' % (pythonw, sys.prefix))

    # Create desktop shortcut file
    desktop_folder = get_special_folder_path("CSIDL_DESKTOPDIRECTORY")
    fname = osp.join(desktop_folder, 'Spyder.lnk')
    desc = 'The Scientific Python Development Environment'
    create_shortcut(pythonw, desc, fname, '"%s"' % script, workdir,
                    osp.join(ico_dir, 'spyder.ico'))
    file_created(fname)
1122748
def _execute_install_command(cmd, parse_output, errors, parsed_packages):
    '''
    
    '''
    out = __salt__['cmd.run_all'](
        cmd,
        output_loglevel='trace',
        python_shell=False
    )
    if out['retcode'] != 0:
        if out['stderr']:
            errors.append(out['stderr'])
        else:
            errors.append(out['stdout'])
    elif parse_output:
        parsed_packages.update(_parse_reported_packages_from_install_output(out['stdout']))
123421
function afterBuild(options) {
  var install = process.sass.binaryPath;
  var target = path.join(__dirname, '..', 'build', options.debug ? 'Debug' : 'Release', 'binding.node');

  mkdir(path.dirname(install), function(err) {
    if (err && err.code !== 'EEXIST') {
      console.error(err.message);
      return;
    }

    fs.stat(target, function(err) {
      if (err) {
        console.error('Build succeeded but target not found');
        return;
      }

      fs.rename(target, install, function(err) {
        if (err) {
          console.error(err.message);
          return;
        }

        console.log('Installed in `', install, '`');
      });
    });
  });
}
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();
    }
}
932945
def _handle_install():
    
    from pyci.server import Server
    if args["install"]:
        server = Server(testmode=args["nolive"])
        for xpath in args["install"]:
            server.install(xpath)
            okay("Installed {} into the CI server.".format(xpath))
    if args["uninstall"]:
        server = Server(testmode=args["nolive"])
        for xpath in args["uninstall"]:
            server.uninstall(xpath)
            okay("Uninstalled {} from the CI server.".format(xpath))
425496
function process(){
		if (!conf.configured) that.configure();
		var args = command.args.slice(0);
		for(var i in args){
			var arg = args[i];
			if(conf.regexp.test(arg)){
				var catchWord = RegExp.$2;
				switch(RegExp.$1){
					case '-': 
						processShortKey(catchWord, i, args);
						break;
					case '--':
						processKey(catchWord, i, args);
						break;
				}
			} else {
				addArgument(arg);
			}
		}
		conf.processed = true
	}
430282
function (cmd, cb) {
  var internalCmd = internalCommand(cmd);
  if (internalCmd) {
    return cb(['info', internalCmd]);
  }
  $document.trigger('console:run', cmd);
}
992323
function runCapturingProcess(options, config, outputFile, base64, onFinish) {
    const scriptFile = utils.filePath(SCRIPT_FILE),
          command = cliCommand(config).split(/[ ]+/),
          cmd = _.union(command, [scriptFile, base64, outputFile]),
          opts = {
              timeout: config.timeout
          };

    logger.debug(
        'Options for script: %s, base64: %s, command: %s',
        JSON.stringify(options), base64, JSON.stringify(cmd)
    );

    utils.execProcess(cmd, opts, (error) => {
        if (config.compress) {
            minimizeImage(outputFile, config.storage, () => onFinish(error));
        } else {
            onFinish(error);
        }
    });
}
825692
function () {

                // Restart button click handler
                var restartBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
                        "autoUpdate",
                        "installNotification",
                        "installNow ",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath);
                };

                // Later button click handler
                var laterBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER,
                        "autoUpdate",
                        "installNotification",
                        "cancel",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    setUpdateStateInJSON('updateInitiatedInPrevSession', false);
                };

                //attaching UpdateBar handlers
                UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked);
                UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked);

                UpdateInfoBar.showUpdateBar({
                    title: Strings.DOWNLOAD_COMPLETE,
                    description: Strings.CLICK_RESTART_TO_UPDATE,
                    needButtons: true
                });

                setUpdateStateInJSON("autoUpdateInProgress", false);
                HealthLogger.sendAnalyticsData(
                    autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED,
                    "autoUpdate",
                    "installNotification",
                    "render",
                    ""
                );
            }
1368083
def execute_prebuild_script(self):
        

        (pb_mod_path, pb_func) = self.prebuild_script.rsplit('.', 1)

        try:  # Prefer prebuild script in working directory
            if pb_mod_path.count('.') >= 1:  # Prebuild script func is nested in a folder
                (mod_folder_path, mod_name) = pb_mod_path.rsplit('.', 1)
                mod_folder_path_fragments = mod_folder_path.split('.')
                working_dir = os.path.join(os.getcwd(), *mod_folder_path_fragments)
            else:
                mod_name = pb_mod_path
                working_dir = os.getcwd()

            working_dir_importer = pkgutil.get_importer(working_dir)
            module_ = working_dir_importer.find_module(mod_name).load_module(mod_name)

        except (ImportError, AttributeError):

            try:  # Prebuild func might be in virtualenv
                module_ = importlib.import_module(pb_mod_path)
            except ImportError:  # pragma: no cover
                raise ClickException(click.style("Failed ", fg="red") + 'to ' + click.style(
                    "import prebuild script ", bold=True) + 'module: "{pb_mod_path}"'.format(
                    pb_mod_path=click.style(pb_mod_path, bold=True)))

        if not hasattr(module_, pb_func):  # pragma: no cover
            raise ClickException(click.style("Failed ", fg="red") + 'to ' + click.style(
                "find prebuild script ", bold=True) + 'function: "{pb_func}" '.format(
                pb_func=click.style(pb_func, bold=True)) + 'in module "{pb_mod_path}"'.format(
                pb_mod_path=pb_mod_path))

        prebuild_function = getattr(module_, pb_func)
        prebuild_function()
1297147
function _run() {
    _verifyCWD();

    var customStartupFilePath = path.resolve(process.cwd() + '/bin/www');

    if (fs.existsSync(customStartupFilePath)) {
        require(customStartupFilePath);
    } else if (fs.existsSync(PROJECT_INDEX)) {
        let service = require(PROJECT_INDEX);
        if (!(service instanceof Service)) {
            utils._stderr(`${PROJECT_INDEX} does not export a Service object`);
            process.exit(1);
        }

        service.listen();
    }
}
436212
function run (command, args, cb) {
    if (typeof cb !== 'function') {
      var cb = cbmain
    }
    my.args = args
    my.command = command
    if (my.state) {
      parseState( function (err) {
        if (err) return cb(err)
        switchboard(cb)
      })
    }
    else {
      readState(function (err, state) {
        if (err) return cb(err)
        setState(state)
        parseState( function (err) {
          if (err) return cb(err)
          switchboard(cb)
        }) //end parseState
      }) // end readState
    }

    function switchboard(cb) {
      switch (my.command) {
      case 'init':
        init(cb);
        break
      case 'add':
        add(cb)
        break
      case 'remove':
        remove(cb);
        break
      case 'bin':
        bin(cb);
        break
      case 'checkout':
        checkout(cb);
        break
      case 'status':
        status(cb);
        break
      case 'push':
        push(cb);
        break
      default:
        cb( erf( (command === undefined) ? '' :
                 'Unknown command: ' + command , usage) )
      }
    } // end SWITCHBOARD
  }
231775
async function runProgram() {
    const args = minimist(process.argv.slice(2));

    if (args.prefix) {
        intercept(function(txt) {
            return `[${pkg.name}]\n${txt}`;
        });
    }

    let latest = await latestVersion(pkg.name, { version: `>${pkg.version}` })
                        .catch(error => pkg.version);
    if (semver.gt(latest, pkg.version)) {
        process.stderr.write(chalk.default.white(`\n     Update available `));
        process.stderr.write(chalk.default.grey(`${pkg.version}`));
        process.stderr.write(chalk.default.white(` -> `));
        process.stderr.write(chalk.default.greenBright(`${latest}\n`));
        process.stderr.write(chalk.default.white(`     Run `));
        process.stderr.write(chalk.default.blueBright(`npm i -g ${pkg.name} `));
        process.stderr.write(chalk.default.white(`to update.\n`));
    }

    if (args.version || args.v) {
        process.stdout.write(pkg.version);
        return 0;
    }

    if (args.h || args.help) {
        help(process.stdout);
        return 0;
    }

    if (args.f || args.folder) {
        let inputDir = args.f.trim();
        let outputDir = (args.o || args.out_folder) ? args.o.trim() : "./";
        if (outputDir.substr(0, 2) === "./") {
            outputDir = path.resolve(process.cwd(), outputDir.substr(2))
        }
        const len = await processFiles(inputDir, outputDir);
        process.stdout.write(chalk`{green Successfully wrote ${len} files}\n`);
        return len;
    }
    else {
        const fileContents = await getInput(args);
        if (fileContents) {
            const activities = await chatdown(fileContents, args);
            const writeConfirmation = await writeOut(activities, args);

            if (typeof writeConfirmation === 'string') {
                process.stdout.write(chalk`{green Successfully wrote file:} {blue ${writeConfirmation}}\n`);
            }
            return 0;
        }
        else {
            help();
            return -1;
        }
    }
}
984019
function install (presetName) {
  debug('run install from scripts, arguments: %o', arguments)

  const name = presetName || tryRequire(/elint-preset-/)[0]

  if (!name) {
    debug('can not fount preset, return')
    return
  }

  const nodeModulesDir = getNodeModulesDir()
  const keep = process.env.npm_config_keep || ''
  const presetModulePath = path.join(nodeModulesDir, name)

  link(presetModulePath, keep)
}
959141
function runAfterSuccessScripts() {
  const autorelease =
    pkg.version === '0.0.0-semantically-released' &&
    parseEnv('TRAVIS', false) &&
    process.env.TRAVIS_BRANCH === 'master' &&
    !parseEnv('TRAVIS_PULL_REQUEST', false)

  const reportCoverage = hasFile('coverage') && !parseEnv('SKIP_CODECOV', false)

  if (!autorelease && !reportCoverage) {
    console.log(
      'No need to autorelease or report coverage. Skipping travis-after-success script...',
    )
  } else {
    const result = spawn.sync(
      resolveBin('concurrently'),
      getConcurrentlyArgs(
        {
          codecov: reportCoverage
            ? `echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'`
            : null,
          release: autorelease
            ? `echo installing semantic-release && npx -p semantic-release@15 -c 'echo running semantic-release && semantic-release'`
            : null,
        },
        {killOthers: false},
      ),
      {stdio: 'inherit'},
    )

    process.exit(result.status)
  }
}
1238401
function installModule(nodeModules, dep, opts, cb) {
    var where = path.join(nodeModules, '..');

    console.log('installing ', where, dep.resolved);
    var cmd = 'npm install ' + dep.resolved;

    if (opts.registry) {
        cmd += ' --registry=' + opts.registry;
    }

    exec(cmd, {
        cwd: where
    }, cb);
}
945949
function setupSystemD (name, options, callback) {
  options.stdOut = (options.logDir && `${options.logDir}/${name}-out.log`) || null
  options.stdErr = (options.logDir && `${options.logDir}/${name}-err.log`) || null

  const filepath = `/etc/systemd/system/${name}.service`

  const script = systemdTemplate(options)

  if (options.dryRun) {
    console.log(script)
    return
  }

  console.log(`Installing service on: ${filepath}`)
  fs.exists(filepath, exists => {
    if(!exists) {
      fs.writeFile(filepath,script, err => {
        if (err) {
          callback(err)
          return
        }

        fs.chmod(filepath,'755', err => {
          if (err) {
            callback(err)
            return
          }

          let cmd = 'systemctl daemon-reload'
          console.log('Running %s...', cmd)
          exec(cmd, err => {
            callback(err, 'SystemD service registered succesfully')
          })
        })
      })
    } else {
      callback('Service already exists, please uninstall first')
    }
  })
}