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
9#include <boost/python/class.hpp>
10#include <boost/python/copy_const_reference.hpp>
11#include <boost/python/def.hpp>
12#include <boost/python/docstring_options.hpp>
13#include <boost/python/make_function.hpp>
14#include <boost/python/module.hpp>
15#include <boost/python/return_value_policy.hpp>
16#include <boost/python/type_id.hpp>
17
18using namespace boost::python;
20
21namespace {
22
23std::string getMajor(const MantidVersion::VersionInfo &self) { return self.major; }
24
25std::string getMinor(const MantidVersion::VersionInfo &self) { return self.minor; }
26
27std::string getPatch(const MantidVersion::VersionInfo &self) { return self.patch; }
28
29std::string getTweak(const MantidVersion::VersionInfo &self) { return self.tweak; }
30
31std::string getStr(const MantidVersion::VersionInfo &self) {
32 return self.major + "." + self.minor + "." + self.patch + self.tweak;
33}
34
35} // namespace
36
38
39 class_<MantidVersion::VersionInfo>("VersionInfo")
40 .add_property("major", make_function(&getMajor), "The major release version")
41 .add_property("minor", make_function(&getMinor), "The minor release version")
42 .add_property("patch", make_function(&getPatch), "The patch release version")
43 .add_property("tweak", make_function(&getTweak), "The tweak release version")
44 .def("__str__", make_function(&getStr), "The version in the standard form: {Major}.{Minor}.{Patch}{Tweak}");
45
46 def("version_str", &Mantid::Kernel::MantidVersion::version, return_value_policy<copy_const_reference>(),
47 "Returns the Mantid version string in the form \"{Major}.{Minor}.{Patch}{Tweak}\"");
49 "Returns a data structure containing the major, minor, patch, and tweak parts of the version.");
50 def("release_notes_url", &Mantid::Kernel::MantidVersion::releaseNotes,
51 "Returns the url to the most applicable release notes");
52 def("revision", &Mantid::Kernel::MantidVersion::revision, return_value_policy<copy_const_reference>(),
53 "Returns the abbreviated SHA-1 of the last commit");
54 def("revision_full", &Mantid::Kernel::MantidVersion::revisionFull, return_value_policy<copy_const_reference>(),
55 "Returns the full SHA-1 of the last commit");
56 def("release_date", &Mantid::Kernel::MantidVersion::releaseDate, "Returns the date of the last commit");
57 def("release_date_and_time", &Mantid::Kernel::MantidVersion::releaseDateAndTime,
58 "Returns the DateAndTime of the last commit");
59 def("doi", &Mantid::Kernel::MantidVersion::doi, "Returns the DOI for this release of Mantid");
60 def("paper_citation", &Mantid::Kernel::MantidVersion::paperCitation, return_value_policy<copy_const_reference>(),
61 "Returns The citation for the Mantid paper");
62}
void export_MantidVersion()
Class containing static methods to return the Mantid version number and date.
static const std::string & revision()
The abbreviated SHA-1 of the last commit.
static const std::string & version()
The full version number.
static const VersionInfo versionInfo()
A data structure containing the full version info.
static std::string doi()
The DOI for this release of Mantid.
static Types::Core::DateAndTime releaseDateAndTime()
The DateAndTime of the last commit.
static std::string releaseDate()
The date of the last commit.
static const std::string & paperCitation()
The citation for the Mantid paper.
static std::string releaseNotes()
The url to the most applicable release notes.
static const std::string & revisionFull()
The full SHA-1 of the last commit.