def get_platform() -> WPILibMavenPlatform: """ Retrieve platform specific information """ # TODO: _PYTHON_HOST_PLATFORM is used for cross builds, # and is returned directly from get_platform. Might # be useful to note for the future. pyplatform = _get_platform() # Check for 64 bit x86 macOS (version agnostic) if re.fullmatch(r"macosx-.*-x86_64", pyplatform): return OSX if pyplatform == "linux-armv7l": try: import distro distro_id = distro.id() if distro_id == "nilrt": pyplatform = "linux-athena" elif distro_id == "raspbian": pyplatform = "linux-raspbian" except Exception: pass try: return _platforms[pyplatform] except KeyError: raise KeyError( f"platform {pyplatform} is not supported by robotpy-build!")
def get_libjvm_path(): """ Return path of libjvm.so for LD_LIBRARY_PATH variable. This is only required for Linux platform, and by looking in a bunch of 'known' paths. """ cur_platform = _get_platform() if cur_platform.startswith("macosx"): return '' else: path_suffix = '/jre/lib/amd64/server' path_prefixes = [ '/usr/lib/jvm/default-java', # ubuntu / debian distros '/usr/lib/jvm/java', # rhel6 '/usr/lib/jvm', # centos6 '/usr/lib64/jvm', # opensuse 13 '/usr/local/lib/jvm/default-java', # alt ubuntu / debian distros '/usr/local/lib/jvm/java', # alt rhel6 '/usr/local/lib/jvm', # alt centos6 '/usr/local/lib64/jvm', # alt opensuse 13 '/usr/local/lib/jvm/java-7-openjdk-amd64', # alt ubuntu / debian distros '/usr/lib/jvm/java-7-openjdk-amd64', # alt ubuntu / debian distros '/usr/local/lib/jvm/java-6-openjdk-amd64', # alt ubuntu / debian distros '/usr/lib/jvm/java-6-openjdk-amd64', # alt ubuntu / debian distros '/usr/lib/jvm/java-7-oracle', # alt ubuntu '/usr/lib/jvm/java-8-oracle', # alt ubuntu '/usr/lib/jvm/java-6-oracle', # alt ubuntu '/usr/local/lib/jvm/java-7-oracle', # alt ubuntu '/usr/local/lib/jvm/java-8-oracle', # alt ubuntu '/usr/local/lib/jvm/java-6-oracle', # alt ubuntu '/usr/lib/jvm/default', # alt centos '/usr/java/latest', # alt centos ] # First check GRAPHLAB_LIBJVM_DIRECTORY which is expected to be a # directory that libjvm.so resides (the path_suffix will not be used) # Then, check GRAPHLAB_JAVA_HOME, which will override JAVA_HOME. if os.environ.has_key('JAVA_HOME'): path_prefixes.insert(0, os.environ['JAVA_HOME']) if os.environ.has_key('GRAPHLAB_JAVA_HOME'): path_prefixes.insert(0, os.environ['GRAPHLAB_JAVA_HOME']) potential_paths = [i + path_suffix for i in path_prefixes] if os.environ.has_key('GRAPHLAB_LIBJVM_DIRECTORY'): potential_paths.insert(0, os.environ['GRAPHLAB_LIBJVM_DIRECTORY']) for path in potential_paths: if os.path.isfile(os.path.join(path, 'libjvm.so')): logging.getLogger(__name__).debug('libjvm.so path used: %s' % path) return path logging.getLogger(__name__).warning( 'libjvm.so not found. Operations ' 'using HDFS may not work.\nSet GRAPHLAB_JAVA_HOME environment variable' ' before starting GraphLab Create to specify preferred java ' 'installation.') return ''
def get_libjvm_path(): """ Return path of libjvm.so for LD_LIBRARY_PATH variable. This is only required for Linux platform, and by looking in a bunch of 'known' paths. """ cur_platform = _get_platform() if cur_platform.startswith("macosx"): return "" else: path_suffix = "/jre/lib/amd64/server" path_prefixes = [ "/usr/lib/jvm/default-java", # ubuntu / debian distros "/usr/lib/jvm/java", # rhel6 "/usr/lib/jvm", # centos6 "/usr/lib64/jvm", # opensuse 13 "/usr/local/lib/jvm/default-java", # alt ubuntu / debian distros "/usr/local/lib/jvm/java", # alt rhel6 "/usr/local/lib/jvm", # alt centos6 "/usr/local/lib64/jvm", # alt opensuse 13 "/usr/local/lib/jvm/java-7-openjdk-amd64", # alt ubuntu / debian distros "/usr/lib/jvm/java-7-openjdk-amd64", # alt ubuntu / debian distros "/usr/local/lib/jvm/java-6-openjdk-amd64", # alt ubuntu / debian distros "/usr/lib/jvm/java-6-openjdk-amd64", # alt ubuntu / debian distros "/usr/lib/jvm/java-7-oracle", # alt ubuntu "/usr/lib/jvm/java-8-oracle", # alt ubuntu "/usr/lib/jvm/java-6-oracle", # alt ubuntu "/usr/local/lib/jvm/java-7-oracle", # alt ubuntu "/usr/local/lib/jvm/java-8-oracle", # alt ubuntu "/usr/local/lib/jvm/java-6-oracle", # alt ubuntu "/usr/lib/jvm/default", # alt centos "/usr/java/latest", # alt centos ] # First check GRAPHLAB_LIBJVM_DIRECTORY which is expected to be a # directory that libjvm.so resides (the path_suffix will not be used) # Then, check GRAPHLAB_JAVA_HOME, which will override JAVA_HOME. if os.environ.has_key("JAVA_HOME"): path_prefixes.insert(0, os.environ["JAVA_HOME"]) if os.environ.has_key("GRAPHLAB_JAVA_HOME"): path_prefixes.insert(0, os.environ["GRAPHLAB_JAVA_HOME"]) potential_paths = [i + path_suffix for i in path_prefixes] if os.environ.has_key("GRAPHLAB_LIBJVM_DIRECTORY"): potential_paths.insert(0, os.environ["GRAPHLAB_LIBJVM_DIRECTORY"]) for path in potential_paths: if os.path.isfile(os.path.join(path, "libjvm.so")): logging.getLogger(__name__).debug("libjvm.so path used: %s" % path) return path logging.getLogger(__name__).warning( "libjvm.so not found. Operations " "using HDFS may not work.\nSet GRAPHLAB_JAVA_HOME environment variable" " before starting GraphLab Create to specify preferred java " "installation." ) return ""
def get_platform() -> WPILibMavenPlatform: """ Retrieve platform specific information """ # TODO: _PYTHON_HOST_PLATFORM is used for cross builds, # and is returned directly from get_platform. Might # be useful to note for the future. pyplatform = _get_platform() try: return _platforms[pyplatform] except KeyError: raise KeyError( f"platform {pyplatform} is not supported by robotpy-build!")
def get_platform() -> WPILibMavenPlatform: """ Retrieve platform specific information """ # TODO: _PYTHON_HOST_PLATFORM is used for cross builds, # and is returned directly from get_platform. Might # be useful to note for the future. pyplatform = _get_platform() # Check for 64 bit x86 macOS (version agnostic) if re.fullmatch(r"macosx-.*-x86_64", pyplatform): pyplatform = "osx" try: return _platforms[pyplatform] except KeyError: raise KeyError( f"platform {pyplatform} is not supported by robotpy-build!")
def get_libjvm_path(): """ Return path of libjvm.so for LD_LIBRARY_PATH variable. This is only required for Linux platform, and by looking in a bunch of 'known' paths. """ cur_platform = _get_platform() path_prefixes = [] path_suffixes = [] jvm_lib_name = '' if cur_platform.startswith("macosx"): return '' else: if sys.platform == 'win32': path_suffixes = ['/jre/bin/server','/bin/server'] jvm_lib_name = 'jvm.dll' else: path_suffixes = ['/jre/lib/amd64/server'] path_prefixes = [ '/usr/lib/jvm/default-java', # ubuntu / debian distros '/usr/lib/jvm/java', # rhel6 '/usr/lib/jvm', # centos6 '/usr/lib64/jvm', # opensuse 13 '/usr/local/lib/jvm/default-java', # alt ubuntu / debian distros '/usr/local/lib/jvm/java', # alt rhel6 '/usr/local/lib/jvm', # alt centos6 '/usr/local/lib64/jvm', # alt opensuse 13 '/usr/local/lib/jvm/java-7-openjdk-amd64', # alt ubuntu / debian distros '/usr/lib/jvm/java-7-openjdk-amd64', # alt ubuntu / debian distros '/usr/local/lib/jvm/java-6-openjdk-amd64', # alt ubuntu / debian distros '/usr/lib/jvm/java-6-openjdk-amd64', # alt ubuntu / debian distros '/usr/lib/jvm/java-7-oracle', # alt ubuntu '/usr/lib/jvm/java-8-oracle', # alt ubuntu '/usr/lib/jvm/java-6-oracle', # alt ubuntu '/usr/local/lib/jvm/java-7-oracle', # alt ubuntu '/usr/local/lib/jvm/java-8-oracle', # alt ubuntu '/usr/local/lib/jvm/java-6-oracle', # alt ubuntu '/usr/lib/jvm/default', # alt centos '/usr/java/latest', # alt centos ] jvm_lib_name = 'libjvm.so' # First check GRAPHLAB_LIBJVM_DIRECTORY which is expected to be a # directory that libjvm.so resides (the path_suffix will not be used) # Then, check GRAPHLAB_JAVA_HOME, which will override JAVA_HOME. potential_paths = [] if os.environ.has_key('JAVA_HOME'): path_prefixes.insert(0, os.environ['JAVA_HOME']) if os.environ.has_key('GRAPHLAB_JAVA_HOME'): path_prefixes.insert(0, os.environ['GRAPHLAB_JAVA_HOME']) # Construct the full paths to search for i in path_suffixes: for j in path_prefixes: potential_paths.append(j + i) if os.environ.has_key('GRAPHLAB_LIBJVM_DIRECTORY'): potential_paths.insert(0, os.environ['GRAPHLAB_LIBJVM_DIRECTORY']) for path in potential_paths: if sys.platform == 'win32': path = path.replace('/','\\') file_to_try = os.path.join(path, jvm_lib_name) if os.path.isfile(file_to_try): logging.getLogger(__name__).debug('%s path used: %s' % (jvm_lib_name, path)) return path global __jvm_lib_warned if not __jvm_lib_warned: __jvm_lib_warned = True logging.getLogger(__name__).debug(jvm_lib_name + ' not found. Operations ' 'using HDFS may not work.\nSet GRAPHLAB_JAVA_HOME environment variable' ' before starting GraphLab Create to specify preferred java ' 'installation.') return ''
def get_libjvm_path(): """ Return path of libjvm.so for LD_LIBRARY_PATH variable. This is only required for Linux platform, and by looking in a bunch of 'known' paths. """ cur_platform = _get_platform() path_prefixes = [] path_suffixes = [] jvm_lib_name = "" if cur_platform.startswith("macosx"): return "" else: if sys.platform == "win32": path_suffixes = ["/jre/bin/server", "/bin/server"] jvm_lib_name = "jvm.dll" else: path_suffixes = ["/jre/lib/amd64/server"] path_prefixes = [ "/usr/lib/jvm/default-java", # ubuntu / debian distros "/usr/lib/jvm/java", # rhel6 "/usr/lib/jvm", # centos6 "/usr/lib64/jvm", # opensuse 13 "/usr/local/lib/jvm/default-java", # alt ubuntu / debian distros "/usr/local/lib/jvm/java", # alt rhel6 "/usr/local/lib/jvm", # alt centos6 "/usr/local/lib64/jvm", # alt opensuse 13 "/usr/local/lib/jvm/java-7-openjdk-amd64", # alt ubuntu / debian distros "/usr/lib/jvm/java-7-openjdk-amd64", # alt ubuntu / debian distros "/usr/local/lib/jvm/java-6-openjdk-amd64", # alt ubuntu / debian distros "/usr/lib/jvm/java-6-openjdk-amd64", # alt ubuntu / debian distros "/usr/lib/jvm/java-7-oracle", # alt ubuntu "/usr/lib/jvm/java-8-oracle", # alt ubuntu "/usr/lib/jvm/java-6-oracle", # alt ubuntu "/usr/local/lib/jvm/java-7-oracle", # alt ubuntu "/usr/local/lib/jvm/java-8-oracle", # alt ubuntu "/usr/local/lib/jvm/java-6-oracle", # alt ubuntu "/usr/lib/jvm/default", # alt centos "/usr/java/latest", # alt centos ] jvm_lib_name = "libjvm.so" # First check GRAPHLAB_LIBJVM_DIRECTORY which is expected to be a # directory that libjvm.so resides (the path_suffix will not be used) # Then, check GRAPHLAB_JAVA_HOME, which will override JAVA_HOME. potential_paths = [] if os.environ.has_key("JAVA_HOME"): path_prefixes.insert(0, os.environ["JAVA_HOME"]) if os.environ.has_key("GRAPHLAB_JAVA_HOME"): path_prefixes.insert(0, os.environ["GRAPHLAB_JAVA_HOME"]) # Construct the full paths to search for i in path_suffixes: for j in path_prefixes: potential_paths.append(j + i) if os.environ.has_key("GRAPHLAB_LIBJVM_DIRECTORY"): potential_paths.insert(0, os.environ["GRAPHLAB_LIBJVM_DIRECTORY"]) for path in potential_paths: if sys.platform == "win32": path = path.replace("/", "\\") file_to_try = os.path.join(path, jvm_lib_name) if os.path.isfile(file_to_try): logging.getLogger(__name__).debug("%s path used: %s" % (jvm_lib_name, path)) return path global __jvm_lib_warned if not __jvm_lib_warned: __jvm_lib_warned = True logging.getLogger(__name__).debug( jvm_lib_name + " not found. Operations " "using HDFS may not work.\nSet GRAPHLAB_JAVA_HOME environment variable" " before starting GraphLab Create to specify preferred java " "installation." ) return ""