Check that imports in 'test_imports' succeed
    otherwise display message in 'install_hints'
437938
def check_sysdeps(vext_files):
    

    @run_in_syspy
    def run(*modules):
        result = {}
        for m in modules:
            if m:
                try:
                    __import__(m)
                    result[m] = True
                except ImportError:
                    result[m] = False
        return result

    success = True
    for vext_file in vext_files:
        with open(vext_file) as f:
            vext = open_spec(f)
            install_hint = " ".join(vext.get('install_hints', ['System dependencies not found']))

            modules = vext.get('test_import', '')
            logger.debug("%s test imports of: %s", vext_file, modules)
            result = run(*modules)
            if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
                for k, v in result.items():
                    logger.debug("%s: %s", k, v)
            if not all(result.values()):
                success = False
                print(install_hint)
    return success
1090379
def check_module(mod_name):
    """"""
    # Special cases #
    if mod_name in module_name: mod_name = module_name[mod_name]
    # Use a try except block #
    try:
        __import__(mod_name)
    except ImportError as e:
        if str(e) != 'No module named %s' % mod_name: raise e
        print 'You do not seem to have the "%s" package properly installed.' \
              ' Either you never installed it or your $PYTHONPATH is not set up correctly.' \
              ' For more instructions see the README file. (%s)' % (mod_name, e)
        sys.exit()
736281
def _validate_install(self):

        '''  '''

        from subprocess import check_output, STDOUT
        sys_command = 'docker --help'
        try:
            check_output(sys_command, shell=True, stderr=STDOUT).decode('utf-8')
            # call(sys_command, stdout=open(devnull, 'wb'))
        except Exception as err:
            raise Exception('"docker" not installed. GoTo: https://www.docker.com')
    
        return True
904151
def check_local_install(ctx, version, ext, server="local"):
    
    here = Path(ctx.releaser.here).resolve()
    dist_dir = here / 'dist'

    all_files = list(dist_dir.glob('*.{}'.format(ext)))
    the_file = all_files[0]
    for f in all_files[1:]:
        if f.stat().st_mtime > the_file.stat().st_mtime:
            the_file = f
            # this is the latest generated file of the given version

    environment = 'env-{}-{}-{}'.format(version, ext, server)
    if server == "local":
        pass
    else:
        # upload to server
        print("** Uploading to server **")
        cmd = 'twine upload {}'.format(the_file)
        # for PyPI, let twine pick the server
        if server != "pypi":
            cmd = cmd + ' -r {}'.format(server)
        result = invoke.run(cmd, warn=True)
        if result.failed:
            print(textwrap.fill("[{}ERROR{}] Something broke trying to upload "
                                "your package. This will be the case if you "
                                "have already uploaded it before. To upload "
                                "again, use a different version number "
                                "(or a different build by including a '+' "
                                "suffix to your version number)."
                                .format(ERROR_COLOR, RESET_COLOR),
                                width=text.get_terminal_size().columns - 1,
                                subsequent_indent=' '*8))
            # print(result.stderr)

    # remove directory if it exists
    if (here / 'env' / environment).exists():
        shutil.rmtree('env' + os.sep + environment)
    invoke.run('python -m venv env{}{}'.format(os.sep, environment))
    other_dependencies(ctx, server, environment)
    if server == "local":
        result = invoke.run('env{0}{1}{0}Scripts{0}pip{2} install {3} --no-cache'
                            .format(os.sep, environment, '.exe', the_file),
                            hide=True)
    else:
        #print("  **Install from server**")
        result = invoke.run('env{0}{1}{0}Scripts{0}pip{2} install -i {3} '
                            '{4}=={5} --no-cache'
                            .format(os.sep, environment, '.exe',
                                    server_url(server),
                                    ctx.releaser.module_name, version),
                            hide=True)
        if result.failed:
            print('[{}ERROR{}] Something broke trying to install your package.'
                  .format(ERROR_COLOR, RESET_COLOR))
            print(result.stderr)
            sys.exit(1)
    print("** Test version of installed package **")

    result = invoke.run('env{0}{1}{0}Scripts{0}python{2} -c '
                        'exec("""import {3}\\nprint({3}.__version__)""")'
                        .format(os.sep, environment, '.exe',
                                (ctx.releaser.module_name).strip()))
    test_version = result.stdout.strip()
    # print(test_version, type(test_version), type(expected_version))
    if Version(test_version) == version:
        results = '{}{} install {} works!{}'.format(GOOD_COLOR, server, ext,
                                                    RESET_COLOR)
    else:
        results = '{}{} install {} broken{}'.format(ERROR_COLOR, server, ext,
                                                    RESET_COLOR)
    print(results)
    return results
728738
public function checkInstallInput()
    {
       
        $defaults = array('extension' => null,
                          'data' => true);
                          
        $this->options = array_merge($defaults, $this->options);
        
        if ($this->options['extension'] == null){
            $this->error("Please provide the 'extension' parameter.", true);
        }
       
    }
315778
def _check_repo_sign_utils_support(name):
    '''
    
    '''
    if salt.utils.path.which(name):
        return True
    else:
        raise CommandExecutionError(
            'utility \'{0}\' needs to be installed or made available in search path'.format(name)
        )
1254864
def _preflight_check(desired, fromrepo, **kwargs):
    '''
    
    '''
    if 'pkg.check_db' not in __salt__:
        return {}
    ret = {'suggest': {}, 'no_suggest': []}
    pkginfo = __salt__['pkg.check_db'](
        *list(desired.keys()), fromrepo=fromrepo, **kwargs
    )
    for pkgname in pkginfo:
        if pkginfo[pkgname]['found'] is False:
            if pkginfo[pkgname]['suggestions']:
                ret['suggest'][pkgname] = pkginfo[pkgname]['suggestions']
            else:
                ret['no_suggest'].append(pkgname)
    return ret
622598
def is_installed(prog):
    """"""
    with open(os.devnull, 'w') as devnull:
        try:
            if os.name == 'nt':
                retcode = subprocess.call(['where', prog], stdout=devnull)
            else:
                retcode = subprocess.call(['which', prog], stdout=devnull)
        except OSError as e:
            # If where or which doesn't exist, a "ENOENT" error will occur (The
            # FileNotFoundError subclass on Python 3).
            if e.errno != errno.ENOENT:
                raise
            retcode = 1

    return retcode == 0
590778
def tryImportAllPlugins(self):
        
        for regItem in self.registeredItems:
            if not regItem.triedImport:
                self.importRegItem(regItem)

        logger.debug("Importing finished.")
132086
def install_deb(pkgname, url):
    """"""
    status = run("dpkg-query -W -f='${{Status}}' {p}; true".format(p=pkgname))
    if ('installed' not in status) or ('not-installed' in status):
        deb = url.rpartition('/')[2]
        debtmp = '/tmp/{}'.format(deb)
        run("wget --no-check-certificate -qc -O '{}' '{}'".format(debtmp, url))
        sudo("dpkg -i '{0}' && rm -f '{0}'".format(debtmp))
        return True
    else:
        return False
1364582
def check_hints(self, reply):
        
        try:
            f_ind = reply.index("hints")
            l_ind = reply.rindex("hints")
        except Exception:
            fail_reason = vdp_const.hints_failure_reason % (reply)
            LOG.error("%s", fail_reason)
            return False, fail_reason
        if f_ind != l_ind:
            # Currently not supported if reply contains a filter keyword
            fail_reason = vdp_const.multiple_hints_failure_reason % (reply)
            LOG.error("%s", fail_reason)
            return False, fail_reason
        try:
            hints_compl = reply.partition("hints")[2]
            hints_val = reply.partition("hints")[2][0:4]
            len_hints = int(hints_val)
            hints_val = hints_compl[4:4 + len_hints]
            hints = int(hints_val)
            if hints != 0:
                fail_reason = vdp_const.nonzero_hints_failure % (hints)
                return False, fail_reason
        except ValueError:
            fail_reason = vdp_const.format_failure_reason % (reply)
            LOG.error("%s", fail_reason)
            return False, fail_reason
        return True, None
771435
def check_backend() -> bool:
        """"""
        try:
            call('gatttool', stdout=PIPE, stderr=PIPE)
            return True
        except OSError as os_err:
            msg = 'gatttool not found: {}'.format(str(os_err))
            _LOGGER.error(msg)
        return False
1035470
def verify_package(verbose=True):
    
    results = (
        verify_directory(verbose),
        verify_experiment_module(verbose),
        verify_config(verbose),
        verify_no_conflicts(verbose),
    )

    ok = all(results)

    return ok
819864
def main(path_dir, requirements_name):
    """"""
    click.echo("\nWARNING: Uninstall libs it's at your own risk!")
    click.echo('\nREMINDER: After uninstall libs, update your requirements '
               'file.\nUse the `pip freeze > requirements.txt` command.')

    click.echo('\n\nList of installed libs and your dependencies added on '
               'project\nrequirements that are not being used:\n')

    check(path_dir, requirements_name)
1238649
def check_dependencies():
    """"""

    print 'Checking dependencies...'
    if not HAS_VIRTUALENV:
        print 'Virtual environment not found.'
        # Try installing it via easy_install...
        if HAS_EASY_INSTALL:
            print 'Installing virtualenv via easy_install...',
            run_command(['easy_install', 'virtualenv'],
                        die_message='easy_install failed to install virtualenv'
                                    '\ndevelopment requires virtualenv, please'
                                    ' install it using your favorite tool')
            if not run_command(['which', 'virtualenv']):
                die('ERROR: virtualenv not found in path.\n\ndevelopment '
                    ' requires virtualenv, please install it using your'
                    ' favorite package management tool and ensure'
                    ' virtualenv is in your path')
            print 'virtualenv installation done.'
        else:
            die('easy_install not found.\n\nInstall easy_install'
                ' (python-setuptools in ubuntu) or virtualenv by hand,'
                ' then rerun.')
    print 'dependency check done.'
926001
def check_install(software='singularity', quiet=True):
    '''
    '''

    cmd = [software, '--version']
    found = False

    try:
        version = run_command(cmd, quiet=True)
    except: # FileNotFoundError
        return found

    if version is not None:
        if version['return_code'] == 0:
            found = True

        if quiet is False:
            version = version['message']
            bot.info("Found %s version %s" % (software.upper(), version))

    return found
964502
def resolve(checks, lazy, quiet):
    
    root = get_root()
    if 'all' in checks:
        checks = os.listdir(root)

    for check_name in sorted(checks):
        pinned_reqs_file = os.path.join(root, check_name, 'requirements.in')
        resolved_reqs_file = os.path.join(root, check_name, 'requirements.txt')

        if os.path.isfile(pinned_reqs_file):
            if not quiet:
                echo_info('Check `{}`:'.format(check_name))

            if not quiet:
                echo_waiting('    Resolving dependencies...')

            pre_packages = read_packages(resolved_reqs_file)
            result = resolve_requirements(pinned_reqs_file, resolved_reqs_file, lazy=lazy)
            if result.code:
                abort(result.stdout + result.stderr)

            if not quiet:
                post_packages = read_packages(resolved_reqs_file)
                display_package_changes(pre_packages, post_packages, indent='    ')