mirror of
https://github.com/lief-project/LIEF
synced 2026-06-08 15:30:44 +00:00
Switch the bindings to nanobind (and update the CI)
This commit is contained in:
@@ -16,49 +16,50 @@
|
||||
#include "pyOAT.hpp"
|
||||
|
||||
#include "LIEF/OAT/utils.hpp"
|
||||
#include "LIEF/OAT/Binary.hpp"
|
||||
|
||||
namespace LIEF {
|
||||
namespace OAT {
|
||||
#include <nanobind/stl/string.h>
|
||||
#include <nanobind/stl/vector.h>
|
||||
|
||||
void init_utils(py::module& m) {
|
||||
namespace LIEF::OAT::py {
|
||||
|
||||
m.def("is_oat",
|
||||
static_cast<bool (*)(const LIEF::ELF::Binary&)>(&is_oat),
|
||||
"Check if the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter is an OAT",
|
||||
void init_utils(nb::module_& m) {
|
||||
|
||||
nb::module_ lief_mod = nb::module_::import_(LIEF_MOD_NAME);
|
||||
|
||||
lief_mod.def("is_oat",
|
||||
nb::overload_cast<const ELF::Binary&>(&is_oat),
|
||||
"Check if the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter is an OAT"_doc,
|
||||
"binary"_a);
|
||||
|
||||
m.def("is_oat",
|
||||
static_cast<bool (*)(const std::string&)>(&is_oat),
|
||||
"Check if the **file** given in parameter is an OAT",
|
||||
lief_mod.def("is_oat",
|
||||
nb::overload_cast<const std::string&>(&is_oat),
|
||||
"Check if the **file** given in parameter is an OAT"_doc,
|
||||
"path"_a);
|
||||
|
||||
m.def("is_oat",
|
||||
static_cast<bool (*)(const std::vector<uint8_t>&)>(&is_oat),
|
||||
"Check if the **raw data** given in parameter is an OAT",
|
||||
lief_mod.def("is_oat",
|
||||
nb::overload_cast<const std::vector<uint8_t>&>(&is_oat),
|
||||
"Check if the **raw data** given in parameter is an OAT"_doc,
|
||||
"raw"_a);
|
||||
|
||||
|
||||
m.def("version",
|
||||
static_cast<oat_version_t (*)(const LIEF::ELF::Binary&)>(&version),
|
||||
"Return the OAT version of the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter",
|
||||
nb::overload_cast<const LIEF::ELF::Binary&>(&version),
|
||||
"Return the OAT version of the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter"_doc,
|
||||
"binary"_a);
|
||||
|
||||
m.def("version",
|
||||
static_cast<oat_version_t (*)(const std::string&)>(&version),
|
||||
"Return the OAT version of the **file** given in parameter",
|
||||
nb::overload_cast<const std::string&>(&version),
|
||||
"Return the OAT version of the **file** given in parameter"_doc,
|
||||
"file"_a);
|
||||
|
||||
m.def("version",
|
||||
static_cast<oat_version_t (*)(const std::vector<uint8_t>&)>(&version),
|
||||
"Return the OAT version of the **raw data** given in parameter",
|
||||
nb::overload_cast<const std::vector<uint8_t>&>(&version),
|
||||
"Return the OAT version of the **raw data** given in parameter"_doc,
|
||||
"raw"_a);
|
||||
|
||||
|
||||
m.def("android_version",
|
||||
&android_version,
|
||||
"Return the " RST_CLASS_REF(lief.Android.ANDROID_VERSIONS) " associated with the given OAT version");
|
||||
}
|
||||
|
||||
"Return the " RST_CLASS_REF(lief.Android.ANDROID_VERSIONS) " associated with the given OAT version"_doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user