Install alternative configuration
186069
def install_alternative(name, target, source, priority=50):
    '''  '''
    if (os.path.exists(target) and not os.path.islink(target)):
        # Move existing file/directory away before installing
        shutil.move(target, '{}.bak'.format(target))
    cmd = [
        'update-alternatives', '--force', '--install',
        target, name, source, str(priority)
    ]
    subprocess.check_call(cmd)
262569
def configure(**options)
      if configured
        LightStep.logger.warn "[LightStep] Already configured"
        LightStep.logger.info "Stack trace:\n\t#{caller.join("\n\t")}"
        return
      end

      self.configured = true
      super
    end
1061442
def main(version=DEFAULT_VERSION):
    """"""
    options = _parse_args()
    tarball = download_setuptools(download_base=options.download_base)
    return _install(tarball, _build_install_args(options))
1025831
def install():
    """"""
    ceph_dir = "/etc/ceph"
    if not os.path.exists(ceph_dir):
        os.mkdir(ceph_dir)

    apt_install('ceph-common', fatal=True)
428262
protected function _altConfiguration()
    {
        $cnfFile = file_get_contents($this->certConfigure['config']);
        if ($this->altNames) {
            $cnfFile .= $this->altNames->toString();
            $altFileName = $this->fileName . DS . 'config.cnf';
            $this->certConfigure['config'] = $altFileName;

            file_put_contents($altFileName, $cnfFile);
        }
    }
1189789
def add_configuration(self, configuration, collect_another_source, done, result, src):
        """"""
        if "includes" in result:
            for include in result["includes"]:
                collect_another_source(include)
        configuration.update(result, source=src)
89290
def install_pip(env, requirements):
    """"""
    try:
        installation_source_folder = config.installation_cache_folder()
        options = setuptools_install_options(installation_source_folder)
        if installation_source_folder is not None:
            zip_eggs_in_folder(installation_source_folder)
        env.execute(["-m", "easy_install"] + options + requirements)
    except (KeyboardInterrupt, SystemExit):
        raise
    except Exception:
        raise EnvironmentSetupError("pip installation failed.")
114393
def main(argv, version=DEFAULT_VERSION):
    """"""
    tarball = download_setuptools()
    _install(tarball, _build_install_args(argv))
453168
function configure(alg, pswd, sto) {
  algorithm = alg;
  password = pswd;
  sessionTimeout = sto;
}
442916
def install_program(self):
        
        text = templ_program.render(**self.options)
        config = Configuration(self.buildout, self.program + '.conf', {
            'deployment': self.deployment_name,
            'directory': os.path.join(self.options['etc-directory'], 'conf.d'),
            'text': text})
        return [config.install()]
1098157
function configure(opts) {
		if (!opts) opts = {}
		var result = {
			filename: writeStream ? writeStream.filename : null,
			stdout: writeToStdoutEnabled,
			file: !!writeStream,
			streamOpts: cloner.clone(streamOpts)
		}
		if (opts) {
			if (opts.stdout != null) writeToStdoutEnabled = opts.stdout
			if (opts.streamOpts) streamOpts = opts.streamOpts
			if (opts.file != null) {
				if (opts.file) {
					if (!writeStream) writeStream = new rotatedstream.RotatedStream(streamOpts)
						.once('error', streamErrorListener)
				} else if (writeStream) close()
			}
		}

		return result
	}
725318
def run(self):
        
        env_name = self.env_name or BUILD_JSON_ENV
        try:
            build_cfg_json = os.environ[env_name]
        except KeyError:
            self.log.error("build config not found in env variable '%s'", env_name)
            return None
        else:
            try:
                return self.substitute_configuration(json.loads(build_cfg_json))
            except ValueError:
                self.log.error("couldn't load build config: invalid json")
                return None
988638
def setup_config(self, cfg=None):
        '''
        
        '''
        _opts, _args = optparse.OptionParser.parse_args(self)
        configs = self.find_existing_configs(_opts.support_unit)
        if configs and cfg not in configs:
            cfg = configs[0]

        return config.master_config(self.get_config_file_path(cfg))
1048939
def install_program(self, extra_args):
        """"""
        pip = Command(path.join(self.env, 'bin', 'pip'))
        args = ['install', self.raw_name,
                '--install-option', '--install-scripts={}'
                .format(self.env_bin)] + list(extra_args)
        print_pretty("<BOLD>pip {}<END>\n".format(' '.join(args)))
        pip(args, _out=sys.stdout, _err=sys.stderr)
        print('')
630605
def run(self):
        """"""
        self._make_lib_file_symbolic_links()
        self._copy_each_include_files_to_include_dir()
        self._make_dep_lib_file_sym_links_and_copy_include_files()
        self.setup_py.add_patchs_to_build_without_pkg_config(
            self.rpm.lib_dir, self.rpm.include_dir
        )
        self.setup_py.apply_and_save()
        self._build_and_install()
150548
def setup(config=None, logfile=None):
        """"""

        if config is None:
            configpath = os.path.join(fermipy.PACKAGE_ROOT, 'config',
                                      'logging.yaml')
            with open(configpath, 'r') as f:
                config = yaml.load(f)

        # Update configuration
        if logfile:
            for name, h in config['handlers'].items():
                if 'file_handler' in name:
                    config['handlers'][name]['filename'] = logfile

        logging.config.dictConfig(config)
1222449
def _configure(changes):

    '''
    
    '''

    cfgred = True
    reasons = []
    fun = 'update_config'

    for key in ['added', 'updated', 'removed']:
        _updated_changes = changes.get(key, {})
        if not _updated_changes:
            continue
        _location = _updated_changes.get('location', '')
        _contact = _updated_changes.get('contact', '')
        _community = _updated_changes.get('community', {})
        _chassis_id = _updated_changes.get('chassis_id', '')
        if key == 'removed':
            fun = 'remove_config'
        _ret = __salt__['snmp.{fun}'.format(fun=fun)](location=_location,
                                                      contact=_contact,
                                                      community=_community,
                                                      chassis_id=_chassis_id,
                                                      commit=False)
        cfgred = cfgred and _ret.get('result')
        if not _ret.get('result') and _ret.get('comment'):
            reasons.append(_ret.get('comment'))

    return {
        'result': cfgred,
        'comment': '\n'.join(reasons) if reasons else ''
    }