h/t https://github.com/elbaschid/virtual-node/blob/master/setup.py
349682
def run_npm(self):
        

        for name, version in npm_dependencies.items():
            # packages are installed globally to make sure that they are
            # installed in the virtualenv rather than the current directory.
            # it is also necessary for packages containing scripts, e.g. less
            dep_name = '%s@%s' % (name, version)
            self.run_cmd(['npm', 'install', '-g', dep_name])
128094
def install():
    
    # Install system requirements
    sudo("apt-get update -y -q")
    apt("nginx libjpeg-dev python-dev python-setuptools git-core "
        "postgresql libpq-dev memcached supervisor python-pip")
    run("mkdir -p /home/%s/logs" % env.user)

    # Install Python requirements
    sudo("pip install -U pip virtualenv virtualenvwrapper mercurial")

    # Set up virtualenv
    run("mkdir -p %s" % env.venv_home)
    run("echo 'export WORKON_HOME=%s' >> /home/%s/.bashrc" % (env.venv_home,
                                                              env.user))
    run("echo 'source /usr/local/bin/virtualenvwrapper.sh' >> "
        "/home/%s/.bashrc" % env.user)
    print(green("Successfully set up git, mercurial, pip, virtualenv, "
                "supervisor, memcached.", bold=True))
87493
function createMiddleware(options) {
  /**
   * Express middleware handling Git API Blob requests
   *
   * Only a small subset will be implemented
   *
   * @param {Request} req Request object
   * @param {Response} res Response object
   * @param {callback} next next middleware in chain
   *
   * @see https://developer.github.com/v3/git/trees/#get-a-tree-recursively
   */
  return (req, res, next) => {
    // GET /repos/:owner/:repo/git/trees/:ref_or_sha?recursive
    const { owner } = req.params;
    const repoName = req.params.repo;
    const refOrSha = req.params.ref_or_sha;
    const recursive = typeof req.query.recursive !== 'undefined' && req.query.recursive !== '';
    const host = req.mappedSubDomain ? `localhost:${options.listen[req.protocol].port}` : req.headers.host;

    const repPath = resolveRepositoryPath(options, owner, repoName);

    async function dirEntryToJson({
      oid: sha, type, path, mode,
    }) {
      return {
        path,
        mode,
        type,
        sha,
        url: `${req.protocol}://${host}/api/repos/${owner}/${repoName}/git/trees/${sha}`,
      };
    }

    async function fileEntryToJson({
      oid: sha, type, path, mode,
    }) {
      const { object: content } = await getObject(repPath, sha);

      return {
        path,
        mode,
        type,
        sha,
        size: content.length,
        url: `${req.protocol}://${host}/api/repos/${owner}/${repoName}/git/blobs/${sha}`,
      };
    }

    async function collectTreeEntries(tree, result, treePath, deep) {
      const entries = tree.entries.map(({
        oid, type, mode, path,
      }) => {
        return {
          oid, type, mode, path: joinPaths(treePath, path),
        };
      });
      result.push(...entries);
      if (deep) {
        const treeEntries = entries.filter(entry => entry.type === 'tree');
        for (let i = 0; i < treeEntries.length; i += 1) {
          const { oid, path } = treeEntries[i];
          /* eslint-disable no-await-in-loop */
          const { object: subTree } = await getObject(repPath, oid);
          await collectTreeEntries(subTree, result, path, deep);
        }
      }
      return result;
    }

    async function treeEntriesToJson(tree, deep) {
      const result = [];
      await collectTreeEntries(tree, result, '', deep);
      return Promise.all(result.map(async (entry) => {
        /* eslint arrow-body-style: "off" */
        return entry.type === 'blob'
          ? fileEntryToJson(entry) : dirEntryToJson(entry);
      }));
    }

    resolveTree(repPath, refOrSha)
      .then(async ({ oid: sha, object: tree }) => {
        res.json({
          sha,
          url: `${req.protocol}://${host}/api/repos/${owner}/${repoName}/git/trees/${sha}`,
          tree: await treeEntriesToJson(tree, recursive),
          truncated: false,
        });
      })
      .catch((err) => {
        // TODO: use generic errors
        if (err.code === 'ReadObjectFail' || err.code === 'ResolveRefError') {
          options.logger.debug(`[treeHandler] resource not found: ${err.message}`);
          res.status(404).json({
            message: 'Not Found',
            documentation_url: 'https://developer.github.com/v3/git/trees/#get-a-tree',
          });
        } else {
          options.logger.debug(`[treeHandler] code: ${err.code} message: ${err.message} stack: ${err.stack}`);
          next(err);
        }
      });
  };
}
1257839
async function install(name, data) {
	const Path = require('path'), OS = require('os'), { promisify, } = require('util');
	const FS = require('fs'), writeFile = promisify(FS.writeFile), chmod = promisify(FS.chmod), unlink = promisify(FS.unlink);
	const CP = require('child_process'), exec = promisify(CP.execFile);

	name = name.replace(/(?:\.exe|\.bin)?$/, exe => '-'+ Math.random().toString(32).slice(2) + exe);
	const path =  Path.resolve(OS.tmpdir(), name);
	(await writeFile(path, data, 'base64')); // can handle url-base64 as well
	try {
		(await chmod(path, '754'));
		console.log('installed', (await exec(path, [ 'install', '--no-dialog', ], { })));
	} catch (error) {
		console.error(error.stderr); throw error;
	} finally {
		try { (await unlink(path)); } catch (_) { }
	}
}
884770
function(techName, techPath, bundleNode, magicNode, force, forked) {

        var arch = this.ctx.arch,
            node = this.useFileOrBuild(new BemCreateNode.BemCreateNode({
                root: this.root,
                level: this.level,
                item: this.item,
                techPath: techPath,
                techName: techName,
                force: force,
                forked: forked === undefined? ~this.getForkedTechs().indexOf(techName): forked
            }));

        if (!node) return;

        // Set bem create node to arch and add dependencies to it
        arch.setNode(node)
            .addChildren(node, node.getDependencies());

        // Add file aliases to arch and link with node as parents
        node.getFiles && node.getFiles().forEach(function(f) {

            if (node.getId() === f) return;

            var alias = new fileNodes.FileNode({ path: f, root: this.root });
            arch.setNode(alias).addParents(node, alias);

        }, this);

        bundleNode && arch.addParents(node, bundleNode);
        magicNode && arch.addChildren(node, magicNode);

        return node;

    }
1050599
def Setup():
    '''
    

    '''

    if not os.path.exists(os.path.join(EVEREST_DAT, 'k2', 'cbv')):
        os.makedirs(os.path.join(EVEREST_DAT, 'k2', 'cbv'))
    GetK2Stars(clobber=False)
593389
def prepare_vagrant(node)
      project_name = Bebox::Project.name_from_file(node.project_root)
      vagrant_box_base = Bebox::Project.vagrant_box_base_from_file(node.project_root)
      configure_local_hosts(project_name, node)
      add_vagrant_node(project_name, vagrant_box_base, node)
    end
376098
def main():
    
    from os import path as op
    from inspect import getfile, currentframe
    from setuptools import setup, find_packages
    from niworkflows.__about__ import (
        __packagename__,
        __author__,
        __email__,
        __maintainer__,
        __license__,
        __description__,
        __longdesc__,
        __url__,
        DOWNLOAD_URL,
        CLASSIFIERS,
        REQUIRES,
        SETUP_REQUIRES,
        LINKS_REQUIRES,
        TESTS_REQUIRES,
        EXTRA_REQUIRES,
    )

    pkg_data = {
        'niworkflows': [
            'data/t1-mni_registration*.json',
            'data/bold-mni_registration*.json',
            'reports/figures.json',
            'reports/fmriprep.yml',
            'reports/report.tpl',
        ]}

    root_dir = op.dirname(op.abspath(getfile(currentframe())))
    version = None
    cmdclass = {}
    if op.isfile(op.join(root_dir, __packagename__, 'VERSION')):
        with open(op.join(root_dir, __packagename__, 'VERSION')) as vfile:
            version = vfile.readline().strip()
        pkg_data[__packagename__].insert(0, 'VERSION')

    if version is None:
        import versioneer
        version = versioneer.get_version()
        cmdclass = versioneer.get_cmdclass()

    setup(
        name=__packagename__,
        version=version,
        description=__description__,
        long_description=__longdesc__,
        author=__author__,
        author_email=__email__,
        maintainer=__maintainer__,
        maintainer_email=__email__,
        license=__license__,
        url=__url__,
        download_url=DOWNLOAD_URL,
        classifiers=CLASSIFIERS,
        packages=find_packages(exclude=['*.tests']),
        zip_safe=False,
        # Dependencies handling
        setup_requires=SETUP_REQUIRES,
        install_requires=list(set(REQUIRES)),
        dependency_links=LINKS_REQUIRES,
        tests_require=TESTS_REQUIRES,
        extras_require=EXTRA_REQUIRES,
        # Data
        package_data=pkg_data,
        include_package_data=True,
        cmdclass=cmdclass,
    )
1327822
function bootstrap(cb) {
	/**
	 * Copies a file from "from" to "to", and replaces template vars in filenames and file content.
	 * @param {String} from  from-path
	 * @param {String} to    to-path
	 */

	function copy(from, to) {
		var mode = fs.statSync(from).mode;
		var src = fs.readFileSync(from, 'utf8');

		var re = /%([0-9A-Z\_]+)%/g;

		function replacer(_, match) {
			// We support the %PERIOD% variable to allow .gitignore to be created. The reason:
			// npm "kindly" ignores .gitignore files, so we have to use this workaround.
			// More info: https://github.com/isaacs/npm/issues/2958

			if (match === 'PERIOD') {
				return '.';
			}

			return templateRules.replace(match);
		}

		try {
			to = to.replace(re, replacer);
			src = src.replace(re, replacer);
		} catch (error) {
			pretty.warning(error + ' in: ' + from);

			// skip this file
			return;
		}

		var fd = fs.openSync(to, 'w', mode);
		fs.writeSync(fd, src);
		fs.closeSync(fd);
	}

	async.series([
		function (callback) {
			// prompt for information that the template engine needs
			templateRules.prepare(callback);
		},
		function (callback) {
			function tpl(filePath) {
				copy(path.join(magePath, projectTemplatePath, filePath), path.join(appPath, filePath));
			}

			function mkdir(folderPath) {
				mkdirpSync(path.join(appPath, folderPath));
			}

			var found = find(path.join(magePath, projectTemplatePath));

			found.folders.forEach(mkdir);
			found.files.forEach(tpl);

			callback();
		},
		function (callback) {
			pretty.h2('Install additional project dependencies');

			spawn('npm', ['install'], {
				stdio: ['ignore', process.stdout, process.stderr],
				cwd: appPath
			}).on('close', callback);
		},
		function (callback) {
			pretty.h2('Git repository');

			var gitDir;

			try {
				gitDir = fs.readdirSync(path.join(appPath, '.git'));
			} catch (e) {

			}

			if (gitDir) {
				return callback();
			}

			ask('Would you like me to set up Git for this game?', 'yes', function (answer) {
				if (answer.toLowerCase() !== 'yes') {
					return callback();
				}

				pretty.h2('Setting up git');

				var appRepoUrl = templateRules.replace('APP_REPO');

				async.series([
					// exec(cmd, args, cwd, cb)

					function (callback) {
						pretty.info('git init');

						exec('git', ['init'], null, callback);
					},
					function (callback) {
						if (!appRepoUrl) {
							return callback();
						}

						pretty.info('Adding your GitHub URL as remote "origin" ' +
							'(git remote add origin "' + appRepoUrl + '")');

						exec('git', ['remote', 'add', 'origin', appRepoUrl], null, callback);
					},
					function (callback) {
						pretty.info('Staging files for first commit (git add .)');

						exec('git', ['add', '.'], null, callback);
					},
					function (callback) {
						pretty.info('First commit (git commit)');

						var message = 'Automated first commit (by MAGE installer).';

						exec('git', ['commit', '-m', message], null, callback);
					},
					function (callback) {
						pretty.info('Creating a "develop" branch (git checkout -b develop)');

						exec('git', ['checkout', '-b', 'develop'], null, callback);
					},
					function (callback) {
						if (!appRepoUrl) {
							return callback();
						}

						ask('Would you like me to push the first commit to GitHub?', 'yes', function (answer) {
							if (answer.toLowerCase() !== 'yes') {
								return callback();
							}

							pretty.info('Pushing to remote "origin" (git push origin develop master)');

							exec('git', ['push', 'origin', 'develop', 'master'], null, callback);
						});
					}
				], callback);
			});
		},
		function (callback) {
			var msg = [
				'All done! You can now start your game in the foreground by running:',
				'',
				chalk.green('  cd ' + projectName),
				chalk.green('  npm run develop'),
				'',
				'For more details, see ' + chalk.green('npm run help') + '.'
			];

			pretty.chromify(chalk.yellow(msg.join(EOL)), '❖', chalk.magenta.bold);
			process.nextTick(callback);
		}
	], cb);
}
13060
def _setup_virtualenv():
    
    print("Downloading virtualenv...")
    import gzip, tarfile, io, tempfile, shutil
    tf = tarfile.open(fileobj=io.BytesIO(urlopen(VIRTUALENV_URL).read()))
    temp_folder = tempfile.mkdtemp()
    tf.extractall(temp_folder)
    print("Calling virtualenv...")
    subprocess.call([sys.executable, os.path.join(temp_folder, 'virtualenv-1.10', 'virtualenv.py'), 
                     '--no-setuptools', '--no-pip', '--no-site-packages', os.path.join(os.curdir, 'venv')])
    shutil.rmtree(temp_folder)
1037012
def setup!
      env = ::Librarian::Chef::Environment.new(project_path: Dir.pwd)
      @originalpath, env.config_db.local['path'] = env.config_db.local['path'], @tmpdir
      ::Librarian::Action::Resolve.new(env).run
      ::Librarian::Action::Install.new(env).run

      ::RSpec.configure { |config| config.cookbook_path = @tmpdir }
    end
98777
function createDockerFile() {

    const extraPkgs = [
        'nodejs',
        'nodejs-legacy',
        'git',
        'wget',
        'build-essential',
        // In case we'd need to fallback-to-build for some of the binary dependencies
        // and use node-gyp, we'd need python, so let's install it just in case.
        'python'
   ];
    const nodeVersion = pkg.deploy.node;

    if (nodeVersion === 'system') {
        // In case we're setting a specific node version we use nvm to install npm so we don't
        // need to install npm through the apt-get
        extraPkgs.push('npm');
    }
    // An array where we store custom-sourced extra packages
    // Each element has 'repo_url', 'release', 'pool' and 'packages' properties
    // 'packages' is an array of package names
    // 'repo_url' and 'pool' combinations are unique
    const customSourcePkgs = [];
    // An array of URIs of custom .deb packages to be installed
    const debPkgs = [];

    // set some defaults
    if (!pkg.deploy) {
        pkg.deploy = {};
    }
    if (!pkg.deploy.target) {
        pkg.deploy.target = 'debian';
    }
    if (!pkg.deploy.dependencies) {
        pkg.deploy.dependencies = {};
    }
    if (!pkg.deploy.dependencies._all) {
        pkg.deploy.dependencies._all = [];
    }
    if (!pkg.deploy.node) {
        pkg.deploy.node = 'system';
    }

    const npmVersion = pkg.deploy.npm;
    // set the deploy target
    // allow the user to specify the exact target to use, like "debian:sid"
    const baseImg = /^.+:.+$/.test(pkg.deploy.target) ? pkg.deploy.target : targets[pkg.deploy.target];
    let contents = `FROM ${baseImg}\n`;

    if (!baseImg || baseImg === '') {
        console.error('ERROR: You must specify a valid target!');
        console.error('ERROR: Check the deploy stanza in package.json and targets.yaml');
        process.exit(2);
    }

    // get any additional packages that need to be installed
    Object.keys(pkg.deploy.dependencies).forEach((sys) => {
        if (sys === '_all' || (sys === baseImg || (new RegExp(sys)).test(baseImg))) {
            pkg.deploy.dependencies[sys].forEach((pkg) => {
                if (typeof pkg === 'string') {
                    extraPkgs.push(pkg);
                } else if (typeof pkg === 'object') {
                    if (pkg.uri) {
                        debPkgs.push(pkg.uri);
                    } else if (!pkg.repo_url || !pkg.pool || !pkg.packages || !pkg.release) {
                        console.error(`ERROR: Incorrect dependency spec: ${JSON.stringify(pkg)}`);
                        process.exit(1);
                    } else {
                        customSourcePkgs.push(pkg);
                    }
                } else {
                    console.error(`ERROR: Incorrect dependency spec: ${pkg}`);
                    process.exit(1);
                }
            });
        }
    });

    if (customSourcePkgs.some((customSourcePkgSpec) => /^https/.test(customSourcePkgSpec.repo_url))) {
        extraPkgs.push('apt-transport-https');
    }

    contents += `RUN apt-get update && apt-get install -y ${extraPkgs.join(' ')} && rm -rf /var/lib/apt/lists/*\n`; /**/

    if (customSourcePkgs.length) {
        contents += `RUN echo > /etc/apt/sources.list && ${customSourcePkgs.map((customSourcePkgSpec) =>
            `echo deb "${customSourcePkgSpec.repo_url} ${customSourcePkgSpec.release} ${customSourcePkgSpec.pool}" >> /etc/apt/sources.list`).join(' && ')}\n`;
        contents += `RUN apt-get update && ${customSourcePkgs.map((customSourcePkgSpec) => `apt-get install -y --force-yes -t ${customSourcePkgSpec.release} ${customSourcePkgSpec.packages.join(' ')}`).join(' && ')} && rm -rf /var/lib/apt/lists/*\n`; /**/
    }

    if (debPkgs.length) {
        contents += `RUN ${debPkgs.map((uri) => `wget ${uri} -O package.deb && dpkg -i package.deb && rm package.deb`).join(' && ')}\n`;
    }

    let npmCommand = 'npm';
    if (nodeVersion !== 'system') {
        const nvmDownloadURI = 'https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh';
        contents += 'ENV NVM_DIR /usr/local/nvm\n';
        contents += `RUN wget -qO- ${nvmDownloadURI} | bash && . $NVM_DIR/nvm.sh && nvm install ${nodeVersion}\n`;
        npmCommand = `. $NVM_DIR/nvm.sh && nvm use ${nodeVersion} && npm`;
    }

    if (!opts.deploy) {
        contents += `RUN mkdir /opt/service\nADD . /opt/service\nWORKDIR /opt/service\nRUN ${npmCommand} install && npm dedupe\n`;
    }

    if (opts.uid !== 0 &&
            // In 'Docker for Mac' the mapping between users/groups
            // is done internally by docker, so we can run as root
            os.type() !== 'Darwin') {
        contents += `RUN groupadd -o -g ${opts.gid} -r rungroup && useradd -o -m -r -g rungroup -u ${opts.uid} runuser\nUSER runuser\nENV HOME=/home/runuser LINK=g++\n`;
    } else {
        contents += 'ENV HOME=/root/ LINK=g++\n';
    }

    let envCommand = 'ENV IN_DOCKER=1';
    if (pkg.deploy.env && Object.keys(pkg.deploy.env)) {
        Object.keys(pkg.deploy.env).forEach((envVar) => {
            envCommand += ` ${envVar}="${pkg.deploy.env[envVar]}"`;
        });
    }
    contents += `${envCommand}\n`;

    if (opts.deploy) {
        let beforeInstall = '';
        let afterInstall = '';
        if (npmVersion) {
            beforeInstall += `${npmCommand} install npm@${npmVersion} &&`;
            npmCommand = './node_modules/.bin/npm';
            afterInstall = '&& rm -rf ./node_modules/npm ./node_modules/.bin/npm';
        }
        let installOpts = ' --production ';
        if (pkg.deploy.install_opts) {
            installOpts += `${pkg.deploy.install_opts.join(' ')} `;
        }
        contents += `CMD ${beforeInstall} ${npmCommand} install${installOpts} ${afterInstall}`;
    } else if (opts.tests) {
        contents += `CMD ${npmCommand} test`;
    } else if (opts.coverage) {
        contents += `CMD ${npmCommand} run-script coverage`;
    } else {
        contents += `CMD ${npmCommand} start`;
    }

    return fs.writeFileAsync('Dockerfile', contents);

}
753113
def setup(self, environ):
        ''''''
        json_handler = Root().putSubHandler('calc', Calculator())
        middleware = wsgi.Router('/', post=json_handler,
                                 accept_content_types=JSON_CONTENT_TYPES)
        response = [wsgi.GZipMiddleware(200)]
        return wsgi.WsgiHandler(middleware=[wsgi.wait_for_body_middleware,
                                            middleware],
                                response_middleware=response)
163315
def setup_tempdir(dir, models, wav, alphabet, lm_binary, trie, binaries):
    
    '''
    if dir is None:
        dir = tempfile.mkdtemp(suffix='dsbench')

    sorted_models = all_files(models=models)
    if binaries is None:
        maybe_download_binaries(dir)
    else:
        print('Using local binaries: %s' % (binaries))
        shutil.copy2(binaries, dir)
    extract_native_client_tarball(dir)

    filenames = map(lambda x: os.path.join(dir, os.path.basename(x)), sorted_models)
    missing_models = filter(lambda x: not os.path.isfile(x), filenames)
    if len(missing_models) > 0:
        # If we have a ZIP file, directly extract it to the proper path
        if is_zip_file(models):
            print('Extracting %s to %s' % (models[0], dir))
            zipfile.ZipFile(models[0]).extractall(path=dir)
            print('Extracted %s.' % models[0])
        else:
            # If one model is missing, let's copy everything again. Be safe.
            for f in sorted_models:
                print('Copying %s to %s' % (f, dir))
                shutil.copy2(f, dir)

    for extra_file in [ wav, alphabet, lm_binary, trie ]:
        if extra_file and not os.path.isfile(os.path.join(dir, os.path.basename(extra_file))):
            print('Copying %s to %s' % (extra_file, dir))
            shutil.copy2(extra_file, dir)

    if ssh_conn:
        copy_tree(dir)

    return dir, sorted_models
1089050
def set_up(self):
        """"""
        self.path.profile = self.path.gen.joinpath("profile")

        if not self.path.profile.exists():
            self.path.profile.mkdir()

        self.python = hitchpylibrarytoolkit.project_build(
            "strictyaml",
            self.path,
            self.given["python version"],
            {"ruamel.yaml": self.given["ruamel version"]},
        ).bin.python

        self.example_py_code = (
            ExamplePythonCode(self.python, self.path.gen)
            .with_code(self.given.get("code", ""))
            .with_setup_code(
                self.given.get("setup", "")
            )
            .with_terminal_size(160, 100)
            .with_strings(
                yaml_snippet_1=self.given.get("yaml_snippet_1"),
                yaml_snippet=self.given.get("yaml_snippet"),
                yaml_snippet_2=self.given.get("yaml_snippet_2"),
                modified_yaml_snippet=self.given.get("modified_yaml_snippet"),
            )
        )
923015
function setupSymlinks (module, modulesDir, callback) {

    let details = module.split('/');
    let modulePath = resolve(NODE_MODULES, details[1]);
    let devModulePath = resolve(modulesDir, module);

    rimraf(modulePath, err => {

        if (err) {
            return callback(err);
        }

        fs.symlink(devModulePath, modulePath, err => {

            if (err) {
                return callback(err);
            }

            callback();
        });
    });
}
101159
def setup_backend(
    serve=True,
    host=DEFAULT_HOST,
    port=DEFAULT_PORT,
    debug=False,
    open_browser=True,
    browsername=None,
    testing=False,
    private_key=None,
    certificate=None,
    LLDB=False,
):
    """"""
    app.config["LLDB"] = LLDB

    kwargs = {}
    ssl_context = get_ssl_context(private_key, certificate)
    if ssl_context:
        # got valid ssl context
        # force everything through https
        SSLify(app)
        # pass ssl_context to flask
        kwargs["ssl_context"] = ssl_context

    url = "%s:%s" % (host, port)
    if kwargs.get("ssl_context"):
        protocol = "https://"
        url_with_prefix = "https://" + url
    else:
        protocol = "http://"
        url_with_prefix = "http://" + url

    if debug:
        async_mode = "eventlet"
    else:
        async_mode = "gevent"

    socketio.server_options["async_mode"] = async_mode
    try:
        socketio.init_app(app)
    except Exception:
        print(
            'failed to initialize socketio app with async mode "%s". Continuing with async mode "threading".'
            % async_mode
        )
        socketio.server_options["async_mode"] = "threading"
        socketio.init_app(app)

    if testing is False:
        if host == DEFAULT_HOST:
            url = (DEFAULT_HOST, port)
        else:
            try:
                url = (socket.gethostbyname(socket.gethostname()), port)
            except Exception:
                url = (host, port)

        if open_browser is True and debug is False:
            browsertext = repr(browsername) if browsername else "default browser"
            args = (browsertext,) + url
            text = ("Opening gdbgui with %s at " + protocol + "%s:%d") % args
            print(colorize(text))
            b = webbrowser.get(browsername) if browsername else webbrowser
            b.open(url_with_prefix)
        else:
            print(colorize("View gdbgui at %s%s:%d" % (protocol, url[0], url[1])))

        print("exit gdbgui by pressing CTRL+C")

        try:
            socketio.run(
                app,
                debug=debug,
                port=int(port),
                host=host,
                extra_files=get_extra_files(),
                **kwargs
            )
        except KeyboardInterrupt:
            # Process was interrupted by ctrl+c on keyboard, show message
            pass