Exemplo n.º 1
0
 def get_library(self, namespace):
     if namespace not in self._libs:
         paths = GIRepository().get_shared_library(namespace)
         if not paths:
             raise NotImplementedError("No shared library")
         path = paths.split(",")[0]
         self._libs[namespace] = self._ffi.dlopen(path)
     return self._libs[namespace]
Exemplo n.º 2
0
 def get_library(self, namespace):
     if namespace not in self._libs:
         paths = GIRepository().get_shared_library(namespace)
         if not paths:
             raise NotImplementedError("No shared library")
         path = paths.split(",")[0]
         self._libs[namespace] = self._ffi.dlopen(path)
     return self._libs[namespace]
Exemplo n.º 3
0
Arquivo: main.py Projeto: pwaller/pgi
 def get_library(self, namespace):
     if namespace not in self._libs:
         paths = GIRepository().get_shared_library(namespace)
         if not paths:
             return
         path = paths.split(",")[0]
         lib = load_ctypes_library(path)
         self._libs[namespace] = lib
     return self._libs[namespace]
Exemplo n.º 4
0
 def get_library(self, namespace):
     if namespace not in self._libs:
         paths = GIRepository().get_shared_library(namespace)
         if not paths:
             return
         path = paths.split(",")[0]
         lib = load_ctypes_library(path)
         self._libs[namespace] = lib
     return self._libs[namespace]
Exemplo n.º 5
0
def may_be_null_is_nullable():
    """If may_be_null returns nullable or if NULL can be passed in.

    This can still be wrong if the specific typelib is older than the linked
    libgirepository.

    https://bugzilla.gnome.org/show_bug.cgi?id=660879#c47
    """

    repo = GIRepository()
    repo.require("GLib", "2.0", 0)
    info = repo.find_by_name("GLib", "spawn_sync")
    # this argument is (allow-none) and can never be (nullable)
    return not info.get_arg(8).may_be_null
Exemplo n.º 6
0
def may_be_null_is_nullable():
    """If may_be_null returns nullable or if NULL can be passed in.

    This can still be wrong if the specific typelib is older than the linked
    libgirepository.

    https://bugzilla.gnome.org/show_bug.cgi?id=660879#c47
    """

    repo = GIRepository()
    repo.require("GLib", "2.0", 0)
    info = repo.find_by_name("GLib", "spawn_sync")
    # this argument is (allow-none) and can never be (nullable)
    return not info.get_arg(8).may_be_null
Exemplo n.º 7
0
def get_dump(typelib_path, skip_abi):
    with open(typelib_path, "rb") as h:
        data = h.read()

    typelib = GITypelib.new_from_memory(data)
    repo = GIRepository.get_default()
    namespace = repo.load_typelib(typelib, 0)
    infos = repo.get_infos(namespace)
    l = handle_list(infos, skip_abi=skip_abi)
    return json.dumps(l, indent=2)
Exemplo n.º 8
0
def get_dump(typelib_path, skip_abi):
    with open(typelib_path, "rb") as h:
        data = h.read()

    typelib = GITypelib.new_from_memory(data)
    repo = GIRepository.get_default()
    namespace = repo.load_typelib(typelib, 0)
    infos = repo.get_infos(namespace)
    l = handle_list(infos, skip_abi=skip_abi)
    return json.dumps(l, indent=2)
Exemplo n.º 9
0
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.

from ctypes import byref
import sys

sys.path.insert(0, '..')

from pgi.clib.gir import GIRepository, GIRepositoryLoadFlags
from pgi.clib.gir import GIArgument
from pgi.clib.glib import GErrorPtr
from pgi.clib.gobject import g_type_init

g_type_init()

repo = GIRepository.get_default()
repo.require("GLib", "2.0", GIRepositoryLoadFlags.LAZY)

function_info = repo.find_by_name("GLib", "warn_message")
if not function_info:
    raise Exception

in_args_type = GIArgument * 5
in_args = in_args_type(
    GIArgument(v_string="GITYPES"),
    GIArgument(v_string=__file__),
    GIArgument(v_uint=42),
    GIArgument(v_string="main"),
    GIArgument(v_string="hello world"),
)
retval = GIArgument()
Exemplo n.º 10
0
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.

from ctypes import byref
import sys
sys.path.insert(0, '..')

from pgi.clib.gir import GIRepository, GIRepositoryLoadFlags
from pgi.clib.gir import GIArgument
from pgi.clib.glib import GErrorPtr
from pgi.clib.gobject import g_type_init

g_type_init()

repo = GIRepository.get_default()
repo.require("GLib", "2.0", GIRepositoryLoadFlags.LAZY)

function_info = repo.find_by_name("GLib", "warn_message")
if not function_info:
    raise Exception

in_args_type = GIArgument * 5
in_args = in_args_type(GIArgument(v_string="GITYPES"),
                       GIArgument(v_string=__file__),
                       GIArgument(v_uint=42),
                       GIArgument(v_string="main"),
                       GIArgument(v_string="hello world"),
)
retval = GIArgument()