3#include "pybind11/stl.h"
4#include "pybind11/pybind11.h"
6#include "uhal/version.hpp"
12 template <
typename... Ts>
18 template <
typename... Args>
19 static auto call(Args &&...
args) ->
decltype(boost::apply_visitor(
args...)) {
20 return boost::apply_visitor(
args...);
40 auto packageInfoClass = py::class_<PackageInfo>(aModule,
"PackageInfo");
42 py::class_<PackageInfo::Version>(packageInfoClass,
"Version")
43 .def_readonly(
"major", &PackageInfo::Version::major)
44 .def_readonly(
"minor", &PackageInfo::Version::minor)
45 .def_readonly(
"patch", &PackageInfo::Version::patch)
46 .def_readonly(
"prerelease", &PackageInfo::Version::prerelease);
48 auto gitInfoClass = py::class_<PackageInfo::Git>(packageInfoClass,
"Git");
49 py::enum_<PackageInfo::Git::RefType>(gitInfoClass,
"RefType")
50 .value(
"Tag", PackageInfo::Git::kTag)
51 .value(
"Branch", PackageInfo::Git::kBranch)
55 .def_readonly(
"sha", &PackageInfo::Git::sha)
56 .def_readonly(
"clean", &PackageInfo::Git::clean)
57 .def_readonly(
"ref", &PackageInfo::Git::ref);
59 py::class_<PackageInfo::LocalBuild>(packageInfoClass,
"LocalBuild")
60 .def_readonly(
"_epochTime", &PackageInfo::LocalBuild::epochTime)
61 .def_readonly(
"hostname", &PackageInfo::LocalBuild::hostname)
62 .def_readonly(
"username", &PackageInfo::LocalBuild::username);
64 py::class_<PackageInfo::GitLabBuild>(packageInfoClass,
"GitLabBuild")
65 .def_readonly(
"_epochTime", &PackageInfo::GitLabBuild::epochTime)
66 .def_readonly(
"serverURL", &PackageInfo::GitLabBuild::serverURL)
67 .def_readonly(
"projectPath", &PackageInfo::GitLabBuild::projectPath)
68 .def_readonly(
"projectID", &PackageInfo::GitLabBuild::projectID)
69 .def_readonly(
"pipelineID", &PackageInfo::GitLabBuild::pipelineID)
70 .def_readonly(
"jobID", &PackageInfo::GitLabBuild::jobID);
73 .def_readonly(
"version", &PackageInfo::version)
74 .def_readonly(
"vcs", &PackageInfo::vcs)
75 .def_readonly(
"build", &PackageInfo::build);
void wrap_version_and_build_info(pybind11::module_ &)
const PackageInfo & getPackageInfo()
const PackageInfo::Version & getVersion()
static auto call(Args &&...args) -> decltype(boost::apply_visitor(args...))
Helper class which abstracts away variant's visit function.