def core_load(self, path=None): """Loads core library.""" if self.core.get_handle(): self.core_shutdown() if path is not None: self.library_path = path else: self.library_path = self.settings.qset.value( "Paths/Library", find_library(CORE_NAME)) if not self.library_path: self.library_path = find_library(CORE_NAME) self.core.core_load(self.library_path)
def set_paths(self): path_library = self.qset.value("Paths/Library", find_library(CORE_NAME)) path_data = self.qset.value("Paths/Data", self.core.config.get_path("SharedData")) path_roms = self.qset.value("Paths/ROM") path_scripts = self.qset.value("Paths/Scripts") try: path_plugins = self.qset.value( "Paths/Plugins", os.path.realpath( os.path.dirname(self.parent.worker.plugin_files[0]))) except IndexError: path_plugins = "" try: self.pathROM.setText(path_roms) except TypeError: pass self.pathLibrary.setText(path_library) self.pathPlugins.setText(path_plugins) self.pathData.setText(path_data) self.pathScripts.setText(path_scripts)
def _findlib(libnames, path=None): """.""" platform = sys.platform if platform in ("win32", "cli"): pattern = "%s.dll" elif platform == "darwin": pattern = "lib%s.dylib" else: pattern = "lib%s.so" searchfor = libnames if type(libnames) is dict: # different library names for the platforms if platform == "cli" and platform not in libnames: # if not explicitly specified, use the Win32 libs for IronPython platform = "win32" if platform not in libnames: platform = "DEFAULT" searchfor = libnames[platform] results = [] if path: for libname in searchfor: dllfile = os.path.join(path, pattern % libname) if os.path.exists(dllfile): results.append(dllfile) for libname in searchfor: dllfile = find_library(libname) if dllfile: results.append(dllfile) return results
def core_load(self, path=None): """Loads core library.""" if self.core.get_handle(): self.core_shutdown() if path is not None: self.library_path = path else: self.library_path = self.settings.qset.value( "Paths/Library", find_library(CORE_NAME)) self.core.core_load(str(self.library_path))
def set_paths(self): path_library = self.qset.value( "Paths/Library", find_library(CORE_NAME)) path_data = self.qset.value( "Paths/Data", self.core.config.get_path("SharedData")) path_roms = self.qset.value("Paths/ROM") try: path_plugins = self.qset.value("Paths/Plugins", os.path.realpath( os.path.dirname(self.parent.worker.plugin_files[0]))) except IndexError: path_plugins = "" try: self.pathROM.setText(path_roms) except TypeError: pass self.pathLibrary.setText(path_library) self.pathPlugins.setText(path_plugins) self.pathData.setText(path_data)
def __init__(self, library_name, version_function_name): if sys.platform[:5] == 'linux': library_name = '%s-1.2' % library_name elif sys.platform == 'darwin': library_name = '%s-1.2.0' % library_name self.library_name = library_name library = find_library(library_name) if not library: raise ImportError('Dynamic library "%s" was not found' % \ _platform_library_name(library_name)) self._dll = getattr(cdll, library) # Get the version of the DLL we're using if version_function_name: try: version_function = getattr(self._dll, version_function_name) version_function.restype = POINTER(_SDL_version) self._version = _version_parts(version_function().contents) except AttributeError: self._version = (0, 0, 0) else: self._version = (0, 0, 0)