Installs the mygnuplot shell file
486572
public static void installMyGnuPlot() {
      if(!FOUND_GP) {
        LOG.warn("Skipping Gnuplot Shell Script Install since Gnuplot executable was not found");
        return;
      }
      if(!GP_FILE.exists()) {
        if(!GP_FILE.getParentFile().exists()) {
          GP_FILE.getParentFile().mkdirs();
        }
        InputStream is = null;
        FileOutputStream fos = null;
        try {
          is = GnuplotInstaller.class.getClassLoader().getResourceAsStream(GP_BATCH_FILE_NAME);
          ChannelBuffer buff = new DynamicChannelBuffer(is.available());
          buff.writeBytes(is, is.available());
          is.close(); is = null;
          fos = new FileOutputStream(GP_FILE);
          buff.readBytes(fos, buff.readableBytes());
          fos.close(); fos = null;
          GP_FILE.setExecutable(true);
        } catch (Exception ex) {
          throw new IllegalArgumentException("Failed to install mygnuplot", ex);
        } finally {
          if( is!=null ) try { is.close(); } catch (Exception x) { /* No Op */ }
          if( fos!=null ) try { fos.close(); } catch (Exception x) { /* No Op */ }
        }
      }
    }
612449
def setup_hook(config):
    """"""
    metadata = config['metadata']
    if sys.platform == 'win32':
        requires = metadata.get('requires_dist', '').split('\n')
        metadata['requires_dist'] = "\n".join(requires)
    config['metadata'] = metadata

    metadata['version'] = str(version)

    # pbr's setup_hook replaces easy_install.get_script_args with
    # their own version, override_get_script_args, prefering simpler
    # scripts which are not aware of multi-version.
    # prevent that by doing the opposite.  it's a horrible hack
    # but we are in patching wars already...
    from pbr import packaging

    def my_get_script_args(*args, **kwargs):
        return _main_module()._orig_get_script_args(*args, **kwargs)

    packaging.override_get_script_args = my_get_script_args
    easy_install.get_script_args = my_get_script_args

    # another hack to allow setup from tarball.
    orig_get_version = packaging.get_version

    def my_get_version(package_name, pre_version=None):
        if package_name == 'ryu':
            return str(version)
        return orig_get_version(package_name, pre_version)

    packaging.get_version = my_get_version
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)
}
960969
def setup():
    
    import sys
    already_loaded = 'matplotlib' in sys.modules

    # just make sure we can access matplotlib as mpl
    import matplotlib as mpl

    if not already_loaded:
        mpl.use('Agg')

    import matplotlib.pyplot as plt

    plt.style.use('seaborn')

    general_settings()

    import mpl_toolkits.axes_grid1 as axes_grid1
    axes_grid1
    return plt, mpl
893244
def install(trg_queue, is_down=False, is_triggered=False, user=None,
            group=None, mode=None, item_user=None, item_group=None,
            item_mode=None, hosts=None, is_host_triggered=False):
    ''''''
    mode, user, group, item_user, item_group, item_mode =\
        _def_mode(mode, user, group, item_user, item_group, item_mode)
    if hosts and not hasattr(hosts, '__iter__'):
        raise TypeError('Hosts must be an interable')
    # validate here, so that we don't throw an odd exception on the tmp name
    trg_queue = fsq_path.valid_name(trg_queue)
    # uid_gid makes calls to the pw db and|or gr db, in addition to
    # potentially stat'ing, as such, we want to avoid calling it unless we
    # absoultely have to
    uid, gid = uid_gid(user, group)
    tmp_full, tmp_queue = _tmp_trg(trg_queue, _c.FSQ_ROOT)
    try:
        # open once to cut down on stat/open for chown/chmod combo
        fd = os.open(tmp_full, os.O_RDONLY)
        try:
            # always fchmod here as mkdtemp is different than normal mkdir
            os.fchmod(fd, mode)
            if -1 != uid or -1 != gid:
                os.fchown(fd, uid, gid)
        finally:
            os.close(fd)

        # bless our queue with its children
        _instdir(fsq_path.tmp(tmp_queue), mode, uid, gid)
        _instdir(fsq_path.queue(tmp_queue), mode, uid, gid)
        _instdir(fsq_path.done(tmp_queue), mode, uid, gid)
        _instdir(fsq_path.fail(tmp_queue), mode, uid, gid)

        # down via configure.down if necessary
        if is_down:
            down(tmp_queue, user=item_user, group=item_group, mode=item_mode)
        if is_triggered or _c.FSQ_USE_TRIGGER:
            trigger(tmp_queue, user=item_user, group=item_group,
                    mode=item_mode)

        # atomic commit -- by rename
        os.rename(tmp_full, fsq_path.base(trg_queue))
    except (OSError, IOError, ), e:
        shutil.rmtree(tmp_full)
        if e.errno == errno.ENOTEMPTY:
            raise FSQInstallError(e.errno, u'queue exists: {0}'.format(
                                  trg_queue))
        if isinstance(e, FSQError):
            raise e
        raise FSQInstallError(e.errno, wrap_io_os_err(e))

    if hosts:
        install_host(trg_queue, *hosts, is_down=is_down, user=user,
                     group=group, mode=mode, item_user=item_user,
                     item_group=item_group, item_mode=item_mode)
    if is_host_triggered:
       host_trigger(trg_queue, user=user, group=group, mode=mode)
353109
def install (self):
        """"""
        outs = super(MyInstallLib, self).install()
        infile = self.create_conf_file()
        outfile = os.path.join(self.install_dir, os.path.basename(infile))
        self.copy_file(infile, outfile)
        outs.append(outfile)
        return outs
563167
def run(self):
    """"""
    if self.formats != ["gztar"]:
      print("'setup.py sdist' unsupported format.")
      sys.exit(1)

    if glob.glob("*.tar.gz"):
      print("'setup.py sdist' remove existing *.tar.gz files from "
            "source directory.")
      sys.exit(1)

    command = "make dist"
    exit_code = subprocess.call(command, shell=True)
    if exit_code != 0:
      raise RuntimeError("Running: {0:s} failed.".format(command))

    if not os.path.exists("dist"):
      os.mkdir("dist")

    source_package_file = glob.glob("*.tar.gz")[0]
    source_package_prefix, _, source_package_suffix = (
        source_package_file.partition("-"))
    sdist_package_file = "{0:s}-python-{1:s}".format(
        source_package_prefix, source_package_suffix)
    sdist_package_file = os.path.join("dist", sdist_package_file)
    os.rename(source_package_file, sdist_package_file)

    # Create and add the PKG-INFO file to the source package.
    with gzip.open(sdist_package_file, 'rb') as input_file:
      with open(sdist_package_file[:-3], 'wb') as output_file:
        shutil.copyfileobj(input_file, output_file)
    os.remove(sdist_package_file)

    self.distribution.metadata.write_pkg_info(".")
    pkg_info_path = "{0:s}-{1:s}/PKG-INFO".format(
        source_package_prefix, source_package_suffix[:-7])
    with tarfile.open(sdist_package_file[:-3], "a:") as tar_file:
      tar_file.add("PKG-INFO", arcname=pkg_info_path)
    os.remove("PKG-INFO")

    with open(sdist_package_file[:-3], 'rb') as input_file:
      with gzip.open(sdist_package_file, 'wb') as output_file:
        shutil.copyfileobj(input_file, output_file)
    os.remove(sdist_package_file[:-3])

    # Inform distutils what files were created.
    dist_files = getattr(self.distribution, "dist_files", [])
    dist_files.append(("sdist", "", sdist_package_file))
917755
def add_hooks():
    # type: () -> None
    

    # Detect virtualenv the hooks should use

    # Detect virtualenv
    virtual_env = conf.getenv('VIRTUAL_ENV')
    if virtual_env is None:
        log.err("You are not inside a virtualenv")
        confirm_msg = (
            "Are you sure you want to use global python installation "
            "to run your git hooks? [y/N] "
        )
        click.prompt(confirm_msg, default=False)
        if not click.confirm(confirm_msg):
            log.info("Cancelling")
            return

        load_venv = ''
    else:
        load_venv = 'source "{}/bin/activate"'.format(virtual_env)

    commit_hook = conf.proj_path('.git/hooks/pre-commit')
    push_hook = conf.proj_path('.git/hooks/pre-push')

    # Write pre-commit hook
    log.info("Adding pre-commit hook <33>{}", commit_hook)
    fs.write_file(commit_hook, util.remove_indent('''
        #!/bin/bash
        PATH="/opt/local/libexec/gnubin:$PATH"
        
        {load_venv}
        
        peltak lint --commit
        
    '''.format(load_venv=load_venv)))

    # Write pre-push hook
    log.info("Adding pre-push hook: <33>{}", push_hook)
    fs.write_file(push_hook, util.remove_indent('''
        #!/bin/bash
        PATH="/opt/local/libexec/gnubin:$PATH"
        
        {load_venv}
        
        peltak test --allow-empty
        
    '''.format(load_venv=load_venv)))

    log.info("Making hooks executable")
    if not context.get('pretend', False):
        os.chmod(conf.proj_path('.git/hooks/pre-commit'), 0o755)
        os.chmod(conf.proj_path('.git/hooks/pre-push'), 0o755)
847690
def install(client, force):
    """"""
    import pkg_resources
    from git.index.fun import hook_path as get_hook_path

    for hook in HOOKS:
        hook_path = Path(get_hook_path(hook, client.repo.git_dir))
        if hook_path.exists():
            if not force:
                click.echo(
                    'Hook already exists. Skipping {0}'.format(str(hook_path)),
                    err=True
                )
                continue
            else:
                hook_path.unlink()

        # Make sure the hooks directory exists.
        hook_path.parent.mkdir(parents=True, exist_ok=True)

        Path(hook_path).write_bytes(
            pkg_resources.resource_string(
                'renku.data', '{hook}.sh'.format(hook=hook)
            )
        )
        hook_path.chmod(hook_path.stat().st_mode | stat.S_IEXEC)
913294
function setup_gnuplot(gnuplot, options) {
  if (options.format === 'svg') { /* Setup gnuplot for SVG */
    gnuplot.stdin.write('set term svg fname \"Helvetica\" fsize 14\n');
  } else if (options.format == 'pdf') {
    /* PDF: setup Gnuplot output to postscript so ps2pdf can interpret it */
    gnuplot.stdin.write('set term postscript landscape enhanced color dashed' +
			'\"Helvetica\" 14\n');
  } else { /* Setup gnuplot for png */
    gnuplot.stdin.write('set term png\n');
  }

  /* Formatting Options */
  if (options.time) {
    gnuplot.stdin.write('set xdata time\n');
    gnuplot.stdin.write('set timefmt "%s"\n');
    gnuplot.stdin.write('set format x "' + time_format(options.time) + '"\n');
    gnuplot.stdin.write('set xlabel "time"\n');
  }
  if (options.title) {
    gnuplot.stdin.write('set title "'+options.title+'"\n');
  }
  if (options.logscale) {
    gnuplot.stdin.write('set logscale y\n');
  }
  if (options.xlabel) {
    gnuplot.stdin.write('set xlabel "'+options.xlabel+'"\n');
  }
  if (options.ylabel) {
    gnuplot.stdin.write('set ylabel "'+options.ylabel+'"\n');
  }

  /* Setup ticks */
  gnuplot.stdin.write('set grid xtics ytics mxtics\n');
  gnuplot.stdin.write('set mxtics\n');

  if (options.nokey) {
    gnuplot.stdin.write('set nokey\n');
  }
}
631603
function installUdevRules() {
	if (!systemSupportsUdev()) {
		return when.reject(new Error('Not supported'));
	}
	return when.promise((resolve, reject) => {
		const cmd = `sudo cp "${UDEV_RULES_ASSET_FILE}" "${UDEV_RULES_SYSTEM_FILE}"`;
		console.log(cmd);
		childProcess.exec(cmd, err => {
			if (err) {
				_udevRulesInstalled = undefined;
				return reject(new VError(err, 'Could not install udev rules'));
			}
			_udevRulesInstalled = true;
			resolve();
		});
	});
}
740886
def run(self):
        """"""
        install.run(self)

        #
        # Remove old pygubu.py from scripts path if exists
        spath = os.path.join(self.install_scripts, 'pygubu')
        for ext in ('.py', '.pyw'):
            filename = spath + ext
            if os.path.exists(filename):
                os.remove(filename)
        #
        # Remove old pygubu-designer.bat
        if platform.system() == 'Windows':
            spath = os.path.join(self.install_scripts, 'pygubu-designer.bat')
            if os.path.exists(spath):
                os.remove(spath)
1337704
def setup(self, mute_inline_plotting=None, show_plot_outline=None):
        """"""
        assert self.shellwidget is not None

        self.mute_inline_plotting = mute_inline_plotting
        self.show_plot_outline = show_plot_outline

        if self.figviewer is not None:
            self.mute_inline_action.setChecked(mute_inline_plotting)
            self.show_plot_outline_action.setChecked(show_plot_outline)
            return

        self.figviewer = FigureViewer(background_color=self.background_color)
        self.figviewer.setStyleSheet("FigureViewer{"
                                     "border: 1px solid lightgrey;"
                                     "border-top-width: 0px;"
                                     "border-bottom-width: 0px;"
                                     "border-left-width: 0px;"
                                     "}")
        self.thumbnails_sb = ThumbnailScrollBar(
            self.figviewer, background_color=self.background_color)

        # Option actions :
        self.setup_option_actions(mute_inline_plotting, show_plot_outline)

        # Create the layout :
        main_widget = QSplitter()
        main_widget.addWidget(self.figviewer)
        main_widget.addWidget(self.thumbnails_sb)
        main_widget.setFrameStyle(QScrollArea().frameStyle())

        self.tools_layout = QHBoxLayout()
        toolbar = self.setup_toolbar()
        for widget in toolbar:
            self.tools_layout.addWidget(widget)
        self.tools_layout.addStretch()
        self.setup_options_button()

        layout = create_plugin_layout(self.tools_layout, main_widget)
        self.setLayout(layout)
1209357
def install():
    
    _version_re = re.compile(r"__version__\s+=\s+(.*)")  # pylint: disable=invalid-name

    with open('./fleaker/__init__.py', 'rb') as file_:
        version = ast.literal_eval(_version_re.search(  # pylint: disable=invalid-name
            file_.read().decode('utf-8')).group(1))

    download_url = ('https://github.com/croscon/fleaker/archive/'
                    'v{}.tar.gz'.format(version))

    setup(
        name='fleaker',
        version=version,
        download_url=download_url,
        description='Tools and extensions to make Flask development easier.',
        url='https://github.com/croscon/fleaker',
        author='Croscon Consulting',
        author_email='open.source@croscon.com',
        license='BSD',
        packages=[
            'fleaker',
            'fleaker.marshmallow',
            'fleaker.marshmallow.fields',
            'fleaker.peewee',
            'fleaker.peewee.fields',
            'fleaker.peewee.mixins',
            'fleaker.peewee.mixins.time',
        ],
        zip_safe=False,
        long_description=__doc__,
        include_package_data=True,
        platforms='any',
        install_requires=[
            'Flask',
            'Flask-Classful',
            'Flask-Login',
            'Flask-Marshmallow',
            'arrow',
            'bcrypt',
            'blinker',
            'marshmallow',
            'marshmallow-jsonschema',
            'peewee',
            'pendulum',
            'phonenumbers',
            'simplejson',
        ],
        classifiers=[
            'Development Status :: 2 - Pre-Alpha',
            'Environment :: Web Environment',
            'Framework :: Flask',
            'Intended Audience :: Developers',
            'License :: OSI Approved :: BSD License',
            'Operating System :: OS Independent',
            'Programming Language :: Python',
            # @TODO: Pick specific Python versions; out of the gate flask does 2.6,
            # 2.7, 3.3, 3.4, and 3.5
            'Programming Language :: Python :: 2',
            'Programming Language :: Python :: 3',
            'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
            'Topic :: Software Development :: Libraries :: Application Frameworks',
            'Topic :: Software Development :: Libraries :: Python Modules',
        ],
        keywords=['flask', 'web development', 'flask extension']
    )
1199547
public function install()
    {
        $file = $this->getFilePath();

        $contents = $this->command->files()->get(SLEEPINGOWL_STUB_PATH.'/bootstrap.stub');
        $this->command->files()->put($file, $contents);
        $filePath = str_replace(base_path(), '', $file);
        $this->command->line("<info>Bootstrap file is [{$filePath}]</info>");
    }
508074
def install_special_glyphs():
    '''
    
    '''
    from_dir = '~/repos/powerline/font'

    run('mkdir -p ~/.local/share/fonts')
    run(flo('cp {from_dir}/PowerlineSymbols.otf  ~/.local/share/fonts'))

    to_dir = '~/.config/fontconfig/conf.d/'
    run(flo('mkdir -p {to_dir}'))
    run(flo('cp {from_dir}/10-powerline-symbols.conf  {to_dir}'))
987740
def setup(basepath=DEFAULT_BASEPATH):
    """"""

    module_version = os.environ.get('MODULE_VERSION', DEFAULT_VERSION)
    moduleshome = os.path.join(basepath, module_version)

    # Abort if MODULESHOME does not exist
    if not os.path.isdir(moduleshome):
        print('payu: warning: MODULESHOME does not exist; disabling '
              'environment modules.')
        os.environ['MODULESHOME'] = ''
        return

    os.environ['MODULE_VERSION'] = module_version
    os.environ['MODULE_VERSION_STACK'] = module_version
    os.environ['MODULESHOME'] = moduleshome

    if 'MODULEPATH' not in os.environ:
        module_initpath = os.path.join(moduleshome, 'init', '.modulespath')
        with open(module_initpath) as initpaths:
            modpaths = [
                line.partition('#')[0].strip()
                for line in initpaths.readlines() if not line.startswith('#')
            ]

        os.environ['MODULEPATH'] = ':'.join(modpaths)

    os.environ['LOADEDMODULES'] = os.environ.get('LOADEDMODULES', '')

    # Environment modules with certain characters will cause corruption
    # when MPI jobs get launched on other nodes (possibly a PBS issue).
    #
    # Bash processes obscure the issue on Raijin, since it occurs in an
    # environment module function, and bash moves those to the end of
    # the environment variable list.
    #
    # Raijin's mpirun wrapper is a bash script, and therefore "fixes" by doing
    # the shuffle and limiting the damage to other bash functions, but some
    # wrappers (e.g. OpenMPI 2.1.x) may not be present.  So we manually patch
    # the problematic variable here.  But a more general solution would be nice
    # someday.

    if 'BASH_FUNC_module()' in os.environ:
        bash_func_module = os.environ['BASH_FUNC_module()']
        os.environ['BASH_FUNC_module()'] = bash_func_module.replace('\n', ';')