Get a fully-qualified library name, like /usr/lib/libgfortran.so.3.0, and returns the lib name needed to be
    passed to the linker in the -l option (for example gfortran)

    :param library_path:
    :return:
327224
def sanitize_lib_name(library_path):
    

    lib_name = os.path.basename(library_path)

    # Some regexp magic needed to extract in a system-independent (mac/linux) way the library name

    tokens = re.findall("lib(.+)(\.so|\.dylib|\.a)(.+)?", lib_name)

    if not tokens:
        raise RuntimeError('Attempting to find %s in directory %s but there are no libraries in this directory'%(lib_name,library_path))


    return tokens[0][0]
733489
public static String libName() throws UnsupportedOperationException {
        String os = System.getProperty("os.name").toLowerCase();
        if (os.startsWith("windows")) {
            return libNameBare()+".dll";

        } else if (os.startsWith("mac os x")) {
            //	    return libNameBare()+".dylib";
            return libNameBare()+".jnilib";

        } else {
            return "lib"+libNameBare()+".so";
        }  
    }
439086
def compiler(name):
    
    pinfo = __get_paths()
    _compiler = local[name]
    _compiler = _compiler.setenv(
        PATH=pinfo["path"], LD_LIBRARY_PATH=pinfo["ld_library_path"])
    return _compiler
336378
def _load_lib():
    """"""
    lib_path = find_lib_path()
    if len(lib_path) == 0:
        return None
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
    lib.LGBM_GetLastError.restype = ctypes.c_char_p
    return lib
1360344
public static String getPlatformLibraryName(final String aLibraryName) {
        String libName = null;

        switch (getArchitecture()) {
            case LINUX_32:
            case LINUX_64:
            case LINUX_ARM:
                libName = LIB_PREFIX + aLibraryName + ".so";
                break;
            case WINDOWS_32:
            case WINDOWS_64:
                libName = aLibraryName + ".dll";
                break;
            case OSX_32:
            case OSX_64:
                libName = LIB_PREFIX + aLibraryName + ".dylib";
                break;
            default:
                LOGGER.warn("Unexpected architecture value: {}", getArchitecture());
                break;
        }

        LOGGER.debug(MessageCodes.UTIL_025, libName);
        return libName;
    }
387787
def infer_reference_name(reference_name_or_path):
    
    # identify all cases where reference name or path matches candidate aliases
    reference_file_name = os.path.basename(reference_name_or_path)
    matches = {'file_name': list(), 'full_path': list()}
    for assembly_name in reference_alias_dict.keys():
        candidate_list = [assembly_name] + reference_alias_dict[assembly_name]
        for candidate in candidate_list:
            if candidate.lower() in reference_file_name.lower():
                matches['file_name'].append(assembly_name)
            elif candidate.lower() in reference_name_or_path.lower():
                matches['full_path'].append(assembly_name)
    # remove duplicate matches (happens due to overlapping aliases)
    matches['file_name'] = list(set(matches['file_name']))
    matches['full_path'] = list(set(matches['full_path']))
    # given set of existing matches, choose one to return
    # (first select based on file_name, then full path. If multiples, use most recent)
    if len(matches['file_name']) == 1:
        match = matches['file_name'][0]
    elif len(matches['file_name']) > 1:
        # separate logic for >1 vs 1 to give informative warning
        match = _most_recent_assembly(matches['file_name'])
        warn(
            ('More than one reference ({}) matches path in header ({}); '
             'the most recent one ({}) was used.').format(
                ','.join(matches['file_name']), reference_file_name, match))
    elif len(matches['full_path']) >= 1:
        # combine full-path logic since warning is the same
        match = _most_recent_assembly(matches['full_path'])
        warn((
            'Reference could not be matched against filename ({}); '
            'using best match against full path ({}).').format(
                reference_name_or_path, match))
    else:
        raise ValueError(
            "Failed to infer genome assembly name for %s" % reference_name_or_path)
    return match
110794
private function getLibPath()
    {
        $reflection = new ReflectionClass('Behat\Gherkin\Gherkin');
        $libPath = rtrim(dirname($reflection->getFilename()) . '/../../../', DIRECTORY_SEPARATOR);

        return $libPath;
    }
934963
def libname(self):
        
        if self.library is not None:
            return "ftypes.{}.so".format(self.library)
        else:
            return "{}.so".format(self.name)
686524
def load_library_handle(libname, path):
    """"""

    if path is None or path in ['None', 'none']:
        # Either could not find a library via ctypes or
        # user-configuration-file, or we could not find it in any of the
        # default locations, or possibly the user intentionally does not want
        # one of the libraries to load.
        return None

    try:
        if os.name == "nt":
            opj_lib = ctypes.windll.LoadLibrary(path)
        else:
            opj_lib = ctypes.CDLL(path)
    except (TypeError, OSError):
        msg = 'The {libname} library at {path} could not be loaded.'
        msg = msg.format(path=path, libname=libname)
        warnings.warn(msg, UserWarning)
        opj_lib = None

    return opj_lib
683087
def _on_library_path_changed(self, renderer, path, new_library_path):
        
        library_name = self.library_list_store[int(path)][self.KEY_STORAGE_ID]

        library_config = self.core_config_model.get_current_config_value("LIBRARY_PATHS", use_preliminary=True,
                                                                         default={})
        library_config[library_name] = new_library_path
        self.core_config_model.set_preliminary_config_value("LIBRARY_PATHS", library_config)
        self._select_row_by_column_value(self.view['library_tree_view'], self.library_list_store,
                                         self.KEY_STORAGE_ID, library_name)
894653
def getfullfilename(file_path):
        ''' 
        '''
        warnings.warn("getfullfilename() is deprecated and will be removed in near future. Use chirptext.io.write_file() instead", DeprecationWarning)
        if file_path:
            return os.path.basename(file_path)
        else:
            return ''
143860
def libpath(self):
        
        from os import path
        return path.join(self.dirpath, self.libname)
816344
@Override
  public File[] getLibraryPath() {
    if (this.libDirs == null) {
      //
      // construct gcc lib path from machine and version
      //
      final StringBuffer buf = new StringBuffer("/lib/gcc-lib/");
      buf.append(GccProcessor.getMachine());
      buf.append('/');
      buf.append(GccProcessor.getVersion());
      //
      // build default path from gcc and system /lib and /lib/w32api
      //
      final String[] impliedLibPath = new String[] {
          buf.toString(), "/lib/w32api", "/lib"
      };
      //
      // read gcc specs file for other library paths
      //
      final String[] specs = GccProcessor.getSpecs();
      final String[][] libpaths = GccProcessor.parseSpecs(specs, "*link:", new String[] {
        "%q"
      });
      String[] libpath;
      if (libpaths[0].length > 0) {
        libpath = new String[libpaths[0].length + 3];
        int i = 0;
        for (; i < libpaths[0].length; i++) {
          libpath[i] = libpaths[0][i];
        }
        libpath[i++] = buf.toString();
        libpath[i++] = "/lib/w32api";
        libpath[i++] = "/lib";
      } else {
        //
        // if a failure to find any matches then
        // use some default values for lib path entries
        libpath = new String[] {
            "/usr/local/lib/mingw", "/usr/local/lib", "/usr/lib/w32api", "/usr/lib/mingw", "/usr/lib", buf.toString(),
            "/lib/w32api", "/lib"
        };
      }
      for (int i = 0; i < libpath.length; i++) {
        if (libpath[i].contains("mingw")) {
          libpath[i] = null;
        }
      }
      //
      // if cygwin then
      // we have to prepend location of gcc32
      // and .. to start of absolute filenames to
      // have something that will exist in the
      // windows filesystem
      if (GccProcessor.isCygwin()) {
        GccProcessor.convertCygwinFilenames(libpath);
      }
      //
      // check that remaining entries are actual directories
      //
      final int count = CUtil.checkDirectoryArray(libpath);
      //
      // populate return array with remaining entries
      //
      this.libDirs = new File[count];
      int index = 0;
      for (final String element : libpath) {
        if (element != null) {
          this.libDirs[index++] = new File(element);
        }
      }
    }
    return this.libDirs;
  }
11946
def _load_lib():
    """"""
    lib_path = _find_lib_path()
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
    # DMatrix functions
    lib.MXGetLastError.restype = ctypes.c_char_p
    return lib
891982
def remove_library_path(path: str) -> bool:
    

    if path in sys.path:
        sys.path.remove(path)
        return True

    return False
96573
def getpaths(self,libname):
        """"""
        if os.path.isabs(libname):
            yield libname
        else:
            # FIXME / TODO return '.' and os.path.dirname(__file__)
            for path in self.getplatformpaths(libname):
                yield path

            path = ctypes.util.find_library(libname)
            if path: yield path
366919
def get_lib_filename(category, name):
    
    base_dir = os.path.dirname(os.path.abspath(__file__))
    if category == 'js':
        filename = os.path.join('js', '{0}.js'.format(name))
    elif category == 'css':
        filename = os.path.join('css', '{0}.css'.format(name))
    elif category == 'html':
        filename = os.path.join('html', '{0}.html'.format(name))
    else:
        raise ValueError("Unknown category")
    return os.path.join(base_dir, 'lib', filename)