Exemplo n.º 1
0
def get_isainfo():
    """Return a list of strings constituting the architecture tags for the
    invoking system."""
    buf = NULL
    buf1 = _get_sysinfo(lib.SI_ARCHITECTURE_64)
    buf2 = _get_sysinfo(lib.SI_ARCHITECTURE_32)

    if buf1 == NULL and buf2 == NULL:
        return
    if buf1 == NULL and buf2:
        buf = buf2
    if buf2 == NULL and buf1:
        buf = buf1

    from pkg.misc import force_text
    # ffi.string returns a bytes
    if buf == NULL:
        buf1 = force_text(ffi.string(ffi.cast("char *", buf1)))
        buf2 = force_text(ffi.string(ffi.cast("char *", buf2)))
        robj = [buf1, buf2]
    else:
        buf = force_text(ffi.string(ffi.cast("char *", buf)))
        robj = [buf]

    return robj
Exemplo n.º 2
0
def get_platform():
    """Return the platform tag ("i86pc") for the invoking system."""
    buf = _get_sysinfo(lib.SI_PLATFORM)
    if buf == NULL:
        return
    from pkg.misc import force_text
    return force_text(ffi.string(ffi.cast("char *", buf)))
Exemplo n.º 3
0
def get_release():
    """Return the release string ("5.11") for the invoking system."""
    buf = _get_sysinfo(lib.SI_RELEASE)
    if buf == NULL:
        return
    from pkg.misc import force_text
    return force_text(ffi.string(ffi.cast("char *", buf)))