Ejemplo n.º 1
0
Archivo: java.py Proyecto: Macowe/jep
def get_java_home():
    global _java_home
    if _java_home is not None:
        return _java_home

    if is_osx():
        # newer macs have an executable to help us
        try:
            result = shell("/usr/libexec/java_home")
            _java_home = result.stdout.decode("utf-8")
            return _java_home
        except CommandFailed:
            traceback.print_exc()
            if not os.path.exists(MAC_JAVA_HOME):
                configure_error("No JAVA_HOME")

        # Apple's JAVA_HOME is predictable, just use that if we can
        # though it doesn't work for Oracle's JDK
        if os.path.exists(MAC_JAVA_HOME):
            _java_home = MAC_JAVA_HOME
            return _java_home

    env_home = os.environ.get("JAVA_HOME")
    if env_home:
        if is_windows():
            # remove quotes from each end if necessary
            env_home = env_home.strip('"')
        if os.path.exists(env_home):
            _java_home = env_home
            return env_home
        else:
            configure_error("Path " + env_home + " indicated by JAVA_HOME does not exist.")

    configure_error("Please set the environment variable JAVA_HOME to a path containing the JDK.")
Ejemplo n.º 2
0
def get_java_home():
    global _java_home
    if _java_home is not None:
        return _java_home

    if is_osx():
        # newer macs have an executable to help us
        try:
            result = shell('/usr/libexec/java_home')
            _java_home = result.stdout.decode("utf-8")
            return _java_home
        except CommandFailed:
            traceback.print_exc()
            if not os.path.exists(MAC_JAVA_HOME):
                configure_error('No JAVA_HOME')

        # Apple's JAVA_HOME is predictable, just use that if we can
        # though it doesn't work for Oracle's JDK
        if os.path.exists(MAC_JAVA_HOME):
            _java_home = MAC_JAVA_HOME
            return _java_home

    env_home = os.environ.get('JAVA_HOME')
    if env_home:
        if is_windows():
           # remove quotes from each end if necessary
            env_home = env_home.strip('"')
        if os.path.exists(env_home):
            _java_home = env_home
            return env_home
        else:
            configure_error("Path " + env_home + " indicated by JAVA_HOME does not exist.")

    configure_error("Please set the environment variable JAVA_HOME to a path containing the JDK.")
Ejemplo n.º 3
0
def get_java_home():
    global _java_home
    if _java_home is not None:
        return _java_home

    if is_osx():
        # newer macs have an executable to help us
        try:
            result = shell('/usr/libexec/java_home')
            _java_home = result.stdout
            return _java_home
        except CommandFailed:
            traceback.print_exc()
            if not os.path.exists(MAC_JAVA_HOME):
                configure_error('No JAVA_HOME')

        # Apple's JAVA_HOME is predictable, just use that if we can
        # though it doesn't work for Oracle's JDK
        if os.path.exists(MAC_JAVA_HOME):
            _java_home = MAC_JAVA_HOME
            return _java_home

    env_home = os.environ.get('JAVA_HOME')
    if env_home and os.path.exists(env_home):
        _java_home = env_home
        return env_home

    configure_error("Please set JAVA_HOME to a path containing the JDK.")
Ejemplo n.º 4
0
Archivo: java.py Proyecto: Macowe/jep
    def run(self):
        warning("Using JAVA_HOME:", get_java_home())

        if is_osx():
            target = os.environ.get("MACOSX_DEPLOYMENT_TARGET")

            if target:
                warning("INFO: the MACOSX_DEPLOYMENT_TARGET environment variable is set:", target)

                result = shell("sw_vers -productVersion")
                if target.split(".")[:2] != result.stdout.split(".")[:2]:
                    warning("This target appears to be incorrect for the system version:", result.stdout)
Ejemplo n.º 5
0
    def run(self):
        warning('Using JAVA_HOME:', get_java_home())

        if is_osx():
            target = os.environ.get('MACOSX_DEPLOYMENT_TARGET')

            if target:
                warning('INFO: the MACOSX_DEPLOYMENT_TARGET environment variable is set:', target)

                result = shell('sw_vers -productVersion')
                if target.split('.')[:2] != result.stdout.split('.')[:2]:
                    warning('This target appears to be incorrect for the system version:', result.stdout)
Ejemplo n.º 6
0
    def run(self):
        if skip_java_build(self):
            log.debug('skipping Java build (up-to-date)')
            return
        warning('Using JAVA_HOME:', get_java_home())

        if is_osx():
            target = os.environ.get('MACOSX_DEPLOYMENT_TARGET')

            if target:
                warning(
                    'INFO: the MACOSX_DEPLOYMENT_TARGET environment variable is set:',
                    target)

                result = shell('sw_vers -productVersion')
                if target.split('.')[:2] != result.stdout.decode(
                        "utf-8").split('.')[:2]:
                    warning(
                        'This target appears to be incorrect for the system version:',
                        result.stdout)