Mantid
Loading...
Searching...
No Matches
MantidVersion.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7
8#include <boost/python/class.hpp>
9#include <boost/python/def.hpp>
10#include <boost/python/docstring_options.hpp>
11#include <boost/python/make_function.hpp>
12#include <boost/python/module.hpp>
13#include <boost/python/type_id.hpp>
14
16
17using namespace boost::python;
19
20namespace {
21
22std::string getMajor(const MantidVersion::VersionInfo &self) { return self.major; }
23
24std::string getMinor(const MantidVersion::VersionInfo &self) { return self.minor; }
25
26std::string getPatch(const MantidVersion::VersionInfo &self) { return self.patch; }
27
28std::string getTweak(const MantidVersion::VersionInfo &self) { return self.tweak; }
29
30std::string getStr(const MantidVersion::VersionInfo &self) {
31 return self.major + "." + self.minor + "." + self.patch + self.tweak;
32}
33
34} // namespace
35
37
38 class_<MantidVersion::VersionInfo>("VersionInfo")
39 .add_property("major", make_function(&getMajor), "The major release version")
40 .add_property("minor", make_function(&getMinor), "The minor release version")
41 .add_property("patch", make_function(&getPatch), "The patch release version")
42 .add_property("tweak", make_function(&getTweak), "The tweak release version")
43 .def("__str__", make_function(&getStr), "The version in the standard form: {Major}.{Minor}.{Patch}{Tweak}");
44
46 "Returns the Mantid version string in the form \"{Major}.{Minor}.{Patch}{Tweak}\"");
48 "Returns a data structure containing the major, minor, patch, and tweak parts of the version.");
49 def("release_notes_url", &Mantid::Kernel::MantidVersion::releaseNotes,
50 "Returns the url to the most applicable release notes");
51 def("revision", &Mantid::Kernel::MantidVersion::revision, "Returns the abbreviated SHA-1 of the last commit");
52 def("revision_full", &Mantid::Kernel::MantidVersion::revisionFull, "Returns the full SHA-1 of the last commit");
53 def("release_date", &Mantid::Kernel::MantidVersion::releaseDate, "Returns the date of the last commit");
54 def("doi", &Mantid::Kernel::MantidVersion::doi, "Returns the DOI for this release of Mantid");
55 def("paper_citation", &Mantid::Kernel::MantidVersion::paperCitation, "Returns The citation for the Mantid paper");
56}
void export_MantidVersion()
Class containing static methods to return the Mantid version number and date.
static const VersionInfo versionInfo()
A data structure containing the full version info.
static const char * version()
The full version number.
static std::string doi()
The DOI for this release of Mantid.
static std::string releaseNotes()
The url to the most applicable release notes.
static std::string paperCitation()
The citation for the Mantid paper.
static const char * revisionFull()
The full SHA-1 of the last commit.
static const char * releaseDate()
The date of the last commit.
static const char * revision()
The abbreviated SHA-1 of the last commit.