Try to detect the two most common installation errors:

    1. Installing on macOS using a Homebrew version of Python
    2. Installing on Linux using Python 2 when GDB is linked with Python 3
760765
def check_install():
    
    if platform.system() == 'Darwin' and sys.executable != '/usr/bin/python':
        print("*" * 79)
        print(textwrap.fill(
            "WARNING: You are not using the version of Python included with "
            "macOS. If you intend to use Voltron with the LLDB included "
            "with Xcode, or GDB installed with Homebrew, it will not work "
            "unless it is installed using the system's default Python. If "
            "you intend to use Voltron with a debugger installed by some "
            "other method, it may be safe to ignore this warning. See the "
            "following documentation for more detailed installation "
            "instructions: "
            "https://github.com/snare/voltron/wiki/Installation", 79))
        print("*" * 79)
    elif platform.system() == 'Linux':
        try:
            output = check_output([
                "gdb", "-batch", "-q", "--nx", "-ex",
                "pi print(sys.version_info.major)"
            ]).decode("utf-8")
            gdb_python = int(output)

            if gdb_python != sys.version_info.major:
                print("*" * 79)
                print(textwrap.fill(
                    "WARNING: You are installing Voltron using Python {0}.x "
                    "and GDB is linked with Python {1}.x. GDB will not be "
                    "able to load Voltron. Please install using Python {1} "
                    "if you intend to use Voltron with the copy of GDB that "
                    "is installed. See the following documentation for more "
                    "detailed installation instructions: "
                    "https://github.com/snare/voltron/wiki/Installation"
                    .format(sys.version_info.major, gdb_python), 79))
                print("*" * 79)
        except:
            pass
1061442
def main(version=DEFAULT_VERSION):
    """"""
    options = _parse_args()
    tarball = download_setuptools(download_base=options.download_base)
    return _install(tarball, _build_install_args(options))
1110891
def main():
    
    print('\n\n /------- AIKIF Installation --------\\')
    print(' |  s. show current setup            |')
    print(' |  f. setup folder structures       |')
    print(' |  c. create sample data            |')
    # not yet - wait for beta release print(' w. wipe data and install everything from scratch')
    print(' |  q. quit                          |')
    print(' \\-----------------------------------/')
    cmd = input('?')
    if cmd == 's':
        show_setup()   
    elif cmd == 'f':
        setup_folders()
    elif cmd == 'c':
        create_sample_data()   
    #elif cmd == 'w':
    #    wipe_and_rebuild_all()
    elif cmd == 'q':
        exit(0)
    main()
547360
def _link_package_versions(self, link, search, ignore_compatibility=True):
        # type: (Link, Search, bool) -> Optional[InstallationCandidate]
        """"""
        version = None
        if link.egg_fragment:
            egg_info = link.egg_fragment
            ext = link.ext
        else:
            egg_info, ext = link.splitext()
            if not ext:
                self._log_skipped_link(link, 'not a file')
                return None
            if ext not in SUPPORTED_EXTENSIONS:
                self._log_skipped_link(
                    link, 'unsupported archive format: %s' % ext,
                )
                return None
            if "binary" not in search.formats and ext == WHEEL_EXTENSION and not ignore_compatibility:
                self._log_skipped_link(
                    link, 'No binaries permitted for %s' % search.supplied,
                )
                return None
            if "macosx10" in link.path and ext == '.zip' and not ignore_compatibility:
                self._log_skipped_link(link, 'macosx10 one')
                return None
            if ext == WHEEL_EXTENSION:
                try:
                    wheel = Wheel(link.filename)
                except InvalidWheelFilename:
                    self._log_skipped_link(link, 'invalid wheel filename')
                    return None
                if canonicalize_name(wheel.name) != search.canonical:
                    self._log_skipped_link(
                        link, 'wrong project name (not %s)' % search.supplied)
                    return None

                if not wheel.supported(self.valid_tags) and not ignore_compatibility:
                    self._log_skipped_link(
                        link, 'it is not compatible with this Python')
                    return None

                version = wheel.version

        # This should be up by the search.ok_binary check, but see issue 2700.
        if "source" not in search.formats and ext != WHEEL_EXTENSION:
            self._log_skipped_link(
                link, 'No sources permitted for %s' % search.supplied,
            )
            return None

        if not version:
            version = _egg_info_matches(egg_info, search.canonical)
        if not version:
            self._log_skipped_link(
                link, 'Missing project version for %s' % search.supplied)
            return None

        match = self._py_version_re.search(version)
        if match:
            version = version[:match.start()]
            py_version = match.group(1)
            if py_version != sys.version[:3]:
                self._log_skipped_link(
                    link, 'Python version is incorrect')
                return None
        try:
            support_this_python = check_requires_python(link.requires_python)
        except specifiers.InvalidSpecifier:
            logger.debug("Package %s has an invalid Requires-Python entry: %s",
                         link.filename, link.requires_python)
            support_this_python = True

        if not support_this_python and not ignore_compatibility:
            logger.debug("The package %s is incompatible with the python "
                         "version in use. Acceptable python versions are: %s",
                         link, link.requires_python)
            return None
        logger.debug('Found link %s, version: %s', link, version)

        return InstallationCandidate(search.supplied, version, link, link.requires_python)
1137013
def fix_lib64(lib_dir, symlink=True):
    
    # PyPy's library path scheme is not affected by this.
    # Return early or we will die on the following assert.
    if is_pypy:
        logger.debug('PyPy detected, skipping lib64 symlinking')
        return
    # Check we have a lib64 library path
    if not [p for p in distutils.sysconfig.get_config_vars().values()
            if isinstance(p, basestring) and 'lib64' in p]:
        return

    logger.debug('This system uses lib64; symlinking lib64 to lib')

    assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
        "Unexpected python lib dir: %r" % lib_dir)
    lib_parent = os.path.dirname(lib_dir)
    top_level = os.path.dirname(lib_parent)
    lib_dir = os.path.join(top_level, 'lib')
    lib64_link = os.path.join(top_level, 'lib64')
    assert os.path.basename(lib_parent) == 'lib', (
        "Unexpected parent dir: %r" % lib_parent)
    if os.path.lexists(lib64_link):
        return
    if symlink:
        os.symlink('lib', lib64_link)
    else:
        copyfile('lib', lib64_link)
269078
def main():
    
    parser = argparse.ArgumentParser(description='Github-based load test')

    parser.add_argument('--version', action='store_true', default=False,
                        help='Displays version and exits.')

    parser.add_argument('--virtualenv', type=str, default='virtualenv',
                        help='Virtualenv executable.')

    parser.add_argument('--python', type=str, default=sys.executable,
                        help='Python executable.')

    parser.add_argument('--config', type=str, default='molotov.json',
                        help='Path of the configuration file.')

    parser.add_argument('repo', help='Github repo', type=str, nargs="?")
    parser.add_argument('run', help='Test to run', nargs="?")

    args = parser.parse_args()

    if args.version:
        print(__version__)
        sys.exit(0)

    tempdir = tempfile.mkdtemp()
    curdir = os.getcwd()
    os.chdir(tempdir)
    print('Working directory is %s' % tempdir)
    try:
        clone_repo(args.repo)
        config_file = os.path.join(tempdir, args.config)

        with open(config_file) as f:
            config = json.loads(f.read())

        # creating the virtualenv
        create_virtualenv(args.virtualenv, args.python)

        # install deps
        if 'requirements' in config['molotov']:
            install_reqs(config['molotov']['requirements'])

        # load deps into sys.path
        pyver = '%d.%d' % (sys.version_info.major, sys.version_info.minor)
        site_pkg = os.path.join(tempdir, 'venv', 'lib', 'python' + pyver,
                                'site-packages')
        site.addsitedir(site_pkg)
        pkg_resources.working_set.add_entry(site_pkg)

        # environment
        if 'env' in config['molotov']:
            for key, value in config['molotov']['env'].items():
                os.environ[key] = value

        run_test(**config['molotov']['tests'][args.run])
    except Exception:
        os.chdir(curdir)
        shutil.rmtree(tempdir, ignore_errors=True)
        raise
1065709
def install_lib(url, replace_existing=False, fix_wprogram=True):
    
    d = tmpdir(tmpdir())
    f = download(url)
    Archive(f).extractall(d)

    clean_dir(d)
    d, src_dlib = find_lib_dir(d)
    move_examples(d, src_dlib)
    fix_examples_dir(src_dlib)
    if fix_wprogram:
        fix_wprogram_in_files(src_dlib)

    targ_dlib = libraries_dir() / src_dlib.name
    if targ_dlib.exists():
        log.debug('library already exists: %s', targ_dlib)
        if replace_existing:
            log.debug('remove %s', targ_dlib)
            targ_dlib.rmtree()
        else:
            raise ConfduinoError('library already exists:' + targ_dlib)

    log.debug('move %s -> %s', src_dlib, targ_dlib)
    src_dlib.move(targ_dlib)

    libraries_dir().copymode(targ_dlib)
    for x in targ_dlib.walk():
        libraries_dir().copymode(x)
    return targ_dlib.name
590185
def execute
      error_preparing = prepare
      unless error_preparing.nil?
        @output.puts "Arduino force-install failed preparation: #{error_preparing}"
        return false
      end

      attempts = 0

      loop do
        if File.exist? package_file
          @output.puts "Arduino package seems to have been downloaded already" if attempts.zero?
          break
        elsif attempts >= DOWNLOAD_ATTEMPTS
          break @output.puts "After #{DOWNLOAD_ATTEMPTS} attempts, failed to download #{package_url}"
        else
          @output.print "Attempting to download Arduino package with #{downloader}"
          download
          @output.puts
        end
        attempts += 1
      end

      if File.exist? extracted_file
        @output.puts "Arduino package seems to have been extracted already"
      elsif File.exist? package_file
        @output.print "Extracting archive with #{extracter}"
        extract
        @output.puts
      end

      if File.exist? self.class.force_install_location
        @output.puts "Arduino package seems to have been installed already"
      elsif File.exist? extracted_file
        install
      else
        @output.puts "Could not find extracted archive (tried #{extracted_file})"
      end

      File.exist? self.class.force_install_location
    end
494313
def look_before_you_leap(self):
        
        errors = []

        try:
            self.check_dependencies()
        except self.Error as exc:
            errors.append(str(exc))

        if self.has_db:
            try:
                self.manager.db_connector.get_collection()
            except Exception as exc:
                errors.append("""
                    ERROR while trying to connect to the MongoDB database:
                        Exception:
                            %s
                        Connector:
                            %s
                    """ % (exc, self.manager.db_connector))

        return "\n".join(errors)
15430
def internal_error(out=sys.stderr, etype=None, evalue=None, tb=None):
    """"""
    print(os.linesep, file=out)
    print("""********** Oops, I did it again. *************

You have found an internal error in %(app)s. Please write a bug report
at %(url)s and include at least the information below:

Not disclosing some of the information below due to privacy reasons is ok.
I will try to help you nonetheless, but you have to give me something
I can work with ;) .
""" % dict(app=AppName, url=SupportUrl), file=out)
    if etype is None:
        etype = sys.exc_info()[0]
    if evalue is None:
        evalue = sys.exc_info()[1]
    print(etype, evalue, file=out)
    if tb is None:
        tb = sys.exc_info()[2]
    traceback.print_exception(etype, evalue, tb, None, out)
    print_app_info(out=out)
    print_proxy_info(out=out)
    print_locale_info(out=out)
    print(os.linesep,
            "******** %s internal error, over and out ********" % AppName, file=out)
898601
def use_gdbs(self, gdbs=True, port=2345):
        
        self.gdbs = gdbs
        self.gdbs_port = port
178517
def warn_import_error(type_of_obj_support: str, caught: ImportError):
    
    msg = StringIO()
    msg.writelines('Import Error while trying to add support for ' + type_of_obj_support + '. You may continue but '
                   'the associated parsers and converters wont be available : \n')
    traceback.print_tb(caught.__traceback__, file=msg)
    msg.writelines(str(caught.__class__.__name__) + ' : ' + str(caught) + '\n')
    warn(msg.getvalue())
1152665
def _library_check(self):
        

        try:
            output = yield from gns3server.utils.asyncio.subprocess_check_output("ldd", self._path)
        except (FileNotFoundError, subprocess.SubprocessError) as e:
            log.warn("Could not determine the shared library dependencies for {}: {}".format(self._path, e))
            return

        p = re.compile("([\.\w]+)\s=>\s+not found")
        missing_libs = p.findall(output)
        if missing_libs:
            raise IOUError("The following shared library dependencies cannot be found for IOU image {}: {}".format(self._path,
                                                                                                                   ", ".join(missing_libs)))
305562
def fix_lib64(lib_dir):
    
    if [p for p in distutils.sysconfig.get_config_vars().values()
        if isinstance(p, basestring) and 'lib64' in p]:
        logger.debug('This system uses lib64; symlinking lib64 to lib')
        assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
            "Unexpected python lib dir: %r" % lib_dir)
        lib_parent = os.path.dirname(lib_dir)
        assert os.path.basename(lib_parent) == 'lib', (
            "Unexpected parent dir: %r" % lib_parent)
        copyfile(lib_parent, os.path.join(os.path.dirname(lib_parent), 'lib64'))
207954
def main(reraise_exceptions=False, **kwargs):
    """"""
    exit_status = 0

    try:
        cli.main(**kwargs)
    except SoftLayer.SoftLayerAPIError as ex:
        if 'invalid api token' in ex.faultString.lower():
            print("Authentication Failed: To update your credentials, use 'slcli config setup'")
            exit_status = 1
        else:
            print(str(ex))
            exit_status = 1
    except SoftLayer.SoftLayerError as ex:
        print(str(ex))
        exit_status = 1
    except exceptions.CLIAbort as ex:
        print(str(ex.message))
        exit_status = ex.code
    except Exception:
        if reraise_exceptions:
            raise

        import traceback
        print("An unexpected error has occured:")
        print(str(traceback.format_exc()))
        print("Feel free to report this error as it is likely a bug:")
        print("    https://github.com/softlayer/softlayer-python/issues")
        print("The following snippet should be able to reproduce the error")
        exit_status = 1

    sys.exit(exit_status)
1352918
def check_error(when='periodic check'):
    

    errors = []
    while True:
        err = glGetError()
        if err == GL_NO_ERROR or (errors and err == errors[-1]):
            break
        errors.append(err)
    if errors:
        msg = ', '.join([repr(ENUM_MAP.get(e, e)) for e in errors])
        err = RuntimeError('OpenGL got errors (%s): %s' % (when, msg))
        err.errors = errors
        err.err = errors[-1]  # pyopengl compat
        raise err
1059381
def prerequisite_check():
    

    # Check Python version
    if sys.version_info < (3, 6):
        version_str = "%s.%s.%s" % sys.version_info[:3]
        # TRANSLATORS: This word is used as a part of search query suggested to users,
        # it may appears in context like "Ubuntu 16.04 install Python 3.7"
        search_url = build_search_query(_("install") + " Python 3.7")
        return _("EH Forwarder Bot requires a minimum of Python 3.6 to run.  You "
                 "are currently using Python {version}. \n"
                 "\n"
                 "You may want to try:\n"
                 "{url}").format(version=version_str, url=search_url)

    # Check installations of modules
    modules_err = _("You may want to visit the modules repository to find a list of "
                    "available modules to install.\n"
                    "https://github.com/blueset/ehForwarderBot/wiki/Channels-Repository")
    # 1. At least 1 master channel must be installed
    try:
        next(pkg_resources.iter_entry_points("ehforwarderbot.master"))
    except StopIteration:
        return _("No master channel detected.  EH Forwarder Bot requires at least one "
                 "master channel installed to run.") + "\n\n" + modules_err

    # 2. At least 1 slave channel must be installed
    try:
        next(pkg_resources.iter_entry_points("ehforwarderbot.slave"))
    except StopIteration:
        return _("No slave channel detected.  EH Forwarder Bot requires at least one "
                 "slave channel installed to run.") + "\n\n" + modules_err