Esempio n. 1
0
File: java.py Progetto: ndjensen/jep
def get_java_include():
    """
    Locate the Java include folders for compiling JNI applications.
    """
    inc_name = 'include'
    if is_apple_jdk():
        inc_name = 'Headers'
    inc = os.path.join(get_java_home(), inc_name)
    if not os.path.exists(inc):
        configure_error("Include folder should be at '{0}' but doesn't exist. "
                        "Please check you've installed the JDK properly.".format(inc))
    jni = os.path.join(inc, "jni.h")
    if not os.path.exists(jni):
        configure_error("jni.h should be in '{0}' but doesn't exist. "
                        "Please check you've installed the JDK properly.".format(jni))

    paths = [inc]

    # Include platform specific headers if found
    include_linux = os.path.join(inc, 'linux')
    if os.path.exists(include_linux):
        paths.append(include_linux)

    include_darwin = os.path.join(inc, 'darwin')
    if os.path.exists(include_darwin):
        paths.append(include_darwin)

    include_win32 = os.path.join(inc, 'win32')
    if os.path.exists(include_win32):
        paths.append(include_win32)

    include_bsd = os.path.join(inc, 'freebsd')
    if os.path.exists(include_bsd):
        paths.append(include_bsd)
    return paths
Esempio n. 2
0
def get_java_include():
    """
    Locate the Java include folders for compiling JNI applications.
    """
    inc_name = 'include'
    if is_apple_jdk():
        inc_name = 'Headers'
    inc = os.path.join(get_java_home(), inc_name)
    if not os.path.exists(inc):
        configure_error("Include folder should be at '{0}' but doesn't exist. " \
                        "Please check you've installed the JDK properly.".format(inc))
    jni = os.path.join(inc, "jni.h")
    if not os.path.exists(jni):
        configure_error("jni.h should be in '{0}' but doesn't exist. " \
                        "Please check you've installed the JDK properly.".format(jni))

    paths = [inc]

    # Include platform specific headers if found
    include_linux = os.path.join(inc, 'linux')
    if os.path.exists(include_linux):
        paths.append(include_linux)

    include_darwin = os.path.join(inc, 'darwin')
    if os.path.exists(include_darwin):
        paths.append(include_darwin)

    include_win32 = os.path.join(inc, 'win32')
    if os.path.exists(include_win32):
        paths.append(include_win32)
    return paths
Esempio 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.")
Esempio n. 4
0
def get_java_lib():
    lib_name = 'lib'
    if is_osx():
        lib_name = 'Libraries'
    lib = os.path.join(get_java_home(), lib_name)
    if not os.path.exists(lib):
        configure_error("Lib folder should be at '{0}' but doesn't exist. " \
                        "Please check you've installed the JDK properly.".format(lib))
    return lib
Esempio n. 5
0
def get_java_lib():
    lib_name = 'lib'
    if is_apple_jdk():
        lib_name = 'Libraries'
    lib = os.path.join(get_java_home(), lib_name)
    if not os.path.exists(lib):
        configure_error("Lib folder should be at '{0}' but doesn't exist. " \
                        "Please check you've installed the JDK properly.".format(lib))
    return lib
Esempio n. 6
0
def get_java_home():
    global JAVA_HOME

    # mac's JAVA_HOME is predictable, just use that if we can
    if is_osx() and os.path.exists(MAC_JAVA_HOME):
        return MAC_JAVA_HOME

    if JAVA_HOME and os.path.exists(JAVA_HOME):
        return JAVA_HOME

    configure_error("Please set JAVA_HOME to a path containing the JDK.")
Esempio n. 7
0
def get_java_home():
    global JAVA_HOME

    # mac's JAVA_HOME is predictable, just use that if we can
    if is_osx() and os.path.exists(MAC_JAVA_HOME):
        return MAC_JAVA_HOME

    if JAVA_HOME and os.path.exists(JAVA_HOME):
        return JAVA_HOME

    configure_error("Please set JAVA_HOME to a path containing the JDK.")
Esempio n. 8
0
File: test.py Progetto: Macowe/jep
 def run(self):
     os.environ["CLASSPATH"] = "build/java/jep.test-{0}.jar{1}tests/lib/sqlitejdbc-v056.jar".format(
         self.distribution.metadata.get_version(), os.pathsep
     )
     if is_windows():
         # Use full path as spawn will only search the system PATH for *.exe on Windows
         if "VIRTUAL_ENV" in os.environ:
             py_loc = os.environ["VIRTUAL_ENV"]
         else:
             if "PYTHONHOME" in os.environ:
                 py_loc = os.environ["PYTHONHOME"]
             else:
                 configure_error(
                     "Please set the environment variable PYTHONHOME for running the tests on Windows without a virtualenv."
                 )
         spawn(["{0}\Scripts\jep.bat".format(py_loc), "runtests.py"], search_path=0)
     else:
         spawn(["jep", "runtests.py"])
Esempio n. 9
0
 def run(self):
     os.environ[
         'CLASSPATH'] = 'build/java/jep.test-{0}.jar{1}tests/lib/sqlitejdbc-v056.jar'.format(
             self.distribution.metadata.get_version(), os.pathsep)
     if is_windows():
         # Use full path as spawn will only search the system PATH for *.exe on Windows
         if 'VIRTUAL_ENV' in os.environ:
             py_loc = os.environ['VIRTUAL_ENV']
         else:
             if 'PYTHONHOME' in os.environ:
                 py_loc = os.environ['PYTHONHOME']
             else:
                 configure_error(
                     'Please set the environment variable PYTHONHOME for running the tests on Windows without a virtualenv.'
                 )
         spawn(['{0}\Scripts\jep.bat'.format(py_loc), 'runtests.py'],
               search_path=0)
     else:
         spawn(['jep', 'runtests.py'])
Esempio n. 10
0
def get_java_include():
    """
    Locate the Java include folders for compiling JNI applications.
    """
    inc_name = 'include'
    if is_osx():
        inc_name = 'Headers'
    inc = os.path.join(get_java_home(), inc_name)
    if not os.path.exists(inc):
        configure_error("Include folder should be at '{0}' but doesn't exist. " \
                        "Please check you've installed the JDK properly.".format(inc))
    jni = os.path.join(inc, "jni.h")
    if not os.path.exists(jni):
        configure_error("jni.h should be in '{0}' but doesn't exist. " \
                        "Please check you've installed the JDK properly.".format(jni))

    paths = [inc]
    include_linux = os.path.join(inc, 'linux')
    if os.path.exists(include_linux):
        paths.append(include_linux)
    return paths
Esempio n. 11
0
File: java.py Progetto: 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.")
Esempio n. 12
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.")
Esempio n. 13
0
def get_java_home():
    global _java_home
    if _java_home is not None:
        return _java_home

    # No need to use /usr/libexec/java_home. In seeq case, we always have java isolated in the toolchain
    # 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.'
    )