Check for presence of external Java 1.7 for tools that require it.
167474
def java(items):
    
    if any([_needs_java(d) for d in items]):
        min_version = "1.7"
        max_version = "1.8"
        with setpath.orig_paths():
            java = utils.which("java")
            if not java:
                return ("java not found on PATH. Java %s required for MuTect and GATK < 3.6." % min_version)
            p = subprocess.Popen([java, "-Xms250m", "-Xmx250m", "-version"],
                                 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            output, _ = p.communicate()
            p.stdout.close()
        version = ""
        for line in output.split("\n"):
            if line.startswith(("java version", "openjdk version")):
                version = line.strip().split()[-1]
                if version.startswith('"'):
                    version = version[1:]
                if version.endswith('"'):
                    version = version[:-1]
        if (not version or LooseVersion(version) >= LooseVersion(max_version) or
            LooseVersion(version) < LooseVersion(min_version)):
            return ("java version %s required for running MuTect and GATK < 3.6.\n"
                    "It needs to be first on your PATH so running 'java -version' give the correct version.\n"
                    "Found version %s at %s" % (min_version, version, java))
1233813
def check_version(mod, required):
    """"""
    vers = tuple(int(v) for v in mod.__version__.split('.')[:3])
    if vers < required:
        req = '.'.join(str(v) for v in required)
        raise ImproperlyConfigured(
            "Module \"%s\" version (%s) must be >= %s." %
            (mod.__name__, mod.__version__, req))
694754
def check_dependencies(self):
        ""
        if self.test_program == 'nose':
            try:
                import nose
            except ImportError:
                sys.exit('Nosetests is not available on your system. Please install it and try to run it again')
        if self.test_program == 'py':
            try:
                import py
            except:
                sys.exit('py.test is not available on your system. Please install it and try to run it again')
        if self.test_program == 'django':
            try:
                import django
            except:
                sys.exit('django is not available on your system. Please install it and try to run it again')
        if self.test_program == 'phpunit':
            try:
                process = subprocess.check_call(['phpunit','--version']) 
            except:
                sys.exit('phpunit is not available on your system. Please install it and try to run it again')
        if self.test_program == 'tox':
            try:
                import tox
            except ImportError:
                sys.exit('tox is not available on your system. Please install it and try to run it again')
19091
def check_version(component, expected_version):
    """"""

    comp = comp_names[component]

    compath = os.path.realpath(os.path.abspath(comp.path))
    sys.path.insert(0, compath)

    import version

    if version.version != expected_version:
        raise EnvironmentError("Version mismatch during release, expected={}, found={}".format(expected_version, version.version))
1328125
private boolean validateResourceIsValid(final Resource externalResource) {
        boolean isValid = true;

        try {
            URL url = externalResource.getURL();
            if (url.getPath() != null && url.getPath().contains(".jar") && !url.getPath().contains("dummyConfig")) {
                throw new IllegalArgumentException("The customer config file: \"config.properties\" was found in a jar file. This is not legal. Offending jar is: " + url.getPath());
            }
        } catch (IOException e) {
            isValid = false;
        }

        return isValid;
    }
712842
def validate_python_version():
    """"""
    python_version = LooseVersion(platform.python_version())
    minimal_version = LooseVersion('3.3.0')
    if python_version < minimal_version:
        print("Sorry, Python 3.3+ is required")
        sys.exit(1)
428591
def CheckTemplates(self, base_dir, version):
    """"""
    major_minor = ".".join(version.split(".")[0:2])
    templates = glob.glob(
        os.path.join(base_dir, "templates/*%s*.zip" % major_minor))
    required_templates = set(
        [x.replace("maj.minor", major_minor) for x in self.REQUIRED_TEMPLATES])

    # Client templates have an extra version digit, e.g. 3.1.0.0
    templates_present = set([
        re.sub(r"_%s[^_]+_" % major_minor, "_%s_" % major_minor,
               os.path.basename(x)) for x in templates
    ])

    difference = required_templates - templates_present
    if difference:
      raise RuntimeError("Missing templates %s" % difference)
170868
private static File findToolsJar() {
        String javaHome = System.getProperty("java.home");
        File javaHomeFile = new File(javaHome);
        File toolsJarFile = new File(javaHomeFile, "lib" + File.separator + TOOLS_JAR_NAME);

        if (!toolsJarFile.exists()) {
            toolsJarFile = new File(System.getenv("java_home"), "lib" + File.separator + TOOLS_JAR_NAME);
        }

        if (!toolsJarFile.exists() && javaHomeFile.getAbsolutePath().endsWith(File.separator + "jre")) {
            javaHomeFile = javaHomeFile.getParentFile();
            toolsJarFile = new File(javaHomeFile, "lib" + File.separator + TOOLS_JAR_NAME);
        }

        if (!toolsJarFile.exists() && isMac() && javaHomeFile.getAbsolutePath().endsWith(File.separator + "Home")) {
            javaHomeFile = javaHomeFile.getParentFile();
            toolsJarFile = new File(javaHomeFile, "Classes" + File.separator + CLASSES_JAR_NAME);
        }

        return toolsJarFile;
    }
872367
def other_dependencies(ctx, server, environment):
    """"""
    if 'extra_packages' in ctx.releaser:
        server = server.lower()
        extra_pkgs = []
        if server in ["local"]:
            if 'local' in ctx.releaser.extra_packages:
                extra_pkgs.extend(ctx.releaser.extra_packages.local)
        elif server in ["testpypi", "pypitest"]:
            # these are packages not available on the test server, so install them
            # off the regular pypi server
            if 'test' in ctx.releaser.extra_packages and \
                                ctx.releaser.extra_packages.test is not None:
                extra_pkgs.extend(ctx.releaser.extra_packages.test)
        elif server in ["pypi"]:
            if 'pypi' in ctx.releaser.extra_packages and \
                                ctx.releaser.extra_packages.pypi is not None:
                extra_pkgs.extend(ctx.releaser.extra_packages.pypi)
        else:
            print("** Nothing more to install **")

        if extra_pkgs:
            print('** Other Dependencies, based on server', server, '**')

        for pkg in extra_pkgs:
            result = invoke.run('env{0}{1}{0}Scripts{0}pip{2} install {3}'
                                .format(os.sep, environment, PIP_EXT, pkg),
                                hide=True)
            if result.ok:
                print('{}[{}GOOD{}] Installed {}'.format("", GOOD_COLOR,
                                                         RESET_COLOR, pkg))
            else:
                print('{}[{}ERROR{}] Something broke trying to install '
                      'package: {}'.format("", ERROR_COLOR, RESET_COLOR, pkg))
                print(result.stderr)
                sys.exit(1)
63253
function checkSemver(localVersion,testRange) {
    var parts = localVersion.split("-");
    return semver.satisfies(parts[0],testRange);
}
907293
function lookForExternalDependenciesJS( _def, javascriptSources ) {
  if ( !_def ) return;
  try {
    const def = convertExternalDependencyDefinition( _def );
    Object.keys( def ).forEach( function ( js ) {
      const
      filename = `mod/${js}`,
      src = new Source( Project, filename ),
      code = src.read();
      pushUnique( javascriptSources, code );
    } );
  } catch ( ex ) {
    Fatal.fire(
      `Unable to parse JS dependencies: ${JSON.stringify(_def)}!\n${ex}`,
      javascriptSources
    );
  }
}
1347609
function getJavaHome() {
	if(!java_home) {
		if(typeof process.env.JAVA_HOME === 'string' && process.env.JAVA_HOME) {
			java_home = process.env.JAVA_HOME;
		} else if(process.platform === 'darwin') {
			java_home = cp.execSync("/usr/libexec/java_home").toString().trim();
		} else if(process.platform === 'linux') {
			//TODO anything magical we can do here to compute the 'default' Java?
		} else if(process.platform === 'win32') {
			//TODO not sure Windows has any way to know where Java is installed
		}
	}
	return java_home;
}
419144
private static boolean isInternal(String clsName) {
        boolean internal = false;
        for (String internalPackage : internalPackages) {
            if (clsName.startsWith(internalPackage)) {
                internal = true;
                break;
            }
        }

        if (internal) {
            for (String externalPackage : externalPackages) {
                if (clsName.startsWith(externalPackage)) {
                    internal = false;
                    break;
                }
            }
        }

        return internal;
    }
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
810994
def _detect(self):
        
        # Detect all version related pragmas and check if they are disallowed.
        results = []
        pragma = self.slither.pragma_directives
        disallowed_pragmas = []
        detected_version = False
        for p in pragma:
            # Skip any pragma directives which do not refer to version
            if len(p.directive) < 1 or p.directive[0] != "solidity":
                continue

            # This is version, so we test if this is disallowed.
            detected_version = True
            reason = self._check_pragma(p.version)
            if reason:
                disallowed_pragmas.append((reason, p))

        # If we found any disallowed pragmas, we output our findings.
        if disallowed_pragmas:
            info = "Detected issues with version pragma in {}:\n".format(self.filename)
            for (reason, p) in disallowed_pragmas:
                info += "\t- {} ({}): {}\n".format(p, p.source_mapping_str, reason)

            json = self.generate_json_result(info)

            # follow the same format than add_nodes_to_json
            json['elements'] = [{'type': 'expression',
                                 'expression': p.version,
                                 'source_mapping': p.source_mapping} for (reason, p) in disallowed_pragmas]
            results.append(json)

        return results
45004
def validate
      java_path = `which java`.rstrip
      raise "You do not have a Java installed, but it is required." if java_path.blank?
    
      output_header
    
      Blueprint::CSS_FILES.keys.each do |file_name|
        css_output_path = File.join(Blueprint::BLUEPRINT_ROOT_PATH, file_name)
        puts "\n\n  Testing #{css_output_path}"
        puts "  Output ============================================================\n\n"
        @error_count += 1 if !system("#{java_path} -jar '#{Blueprint::VALIDATOR_FILE}' -e '#{css_output_path}'")
      end
    
      output_footer
    end
1360628
def _version_checker(module, minver):
    
    # We could use LooseVersion, but distutils imports imp which is deprecated
    version_regexp = r'[a-z]?((?:\d|\.)+\d+)(?:\.dev[0-9]+)?'
    version_tags = re.match(version_regexp, module.__version__)
    if not version_tags:
        return False
    version_tags = version_tags.group(1).split(".")
    version_tags = tuple(int(x) for x in version_tags)
    return version_tags >= minver