Rogue Version Helper
Rogue provides version/query helpers through rogue::Version in C++ and
rogue.Version in Python.
The helper is useful for:
logging the currently installed Rogue version
enforcing minimum/maximum/exact version requirements
retrieving parsed version components (major/minor/maint/devel)
Notes
current()returns the compiled Rogue version string (typically prefixed withv, for examplev6.3.0-0-g<hash>).comparison helpers (
greaterThanEqual,minVersion, etc.) expect version strings inmajor.minor.maintform (for example"6.3.0").pythonVersion()returns a Python-style version string (for example"6.3.0"or"6.3.0.dev4").
Python examples
import rogue
print("Rogue current:", rogue.Version.current())
print("Rogue pythonVersion:", rogue.Version.pythonVersion())
print("major/minor/maint/devel:",
rogue.Version.major(),
rogue.Version.minor(),
rogue.Version.maint(),
rogue.Version.devel())
if not rogue.Version.greaterThanEqual("6.0.0"):
raise RuntimeError("Rogue >= 6.0.0 is required")
# Raises if the requirement is not met.
rogue.Version.minVersion("6.0.0")
import rogue
try:
rogue.Version.exactVersion("6.3.0")
print("Exact version match")
except Exception as exc:
print(f"Version mismatch: {exc}")
C++ examples
#include "rogue/Version.h"
#include <iostream>
int main() {
std::cout << "Rogue current: " << rogue::Version::current() << "\n";
std::cout << "major.minor.maint: "
<< rogue::Version::getMajor() << "."
<< rogue::Version::getMinor() << "."
<< rogue::Version::getMaint() << "\n";
if (!rogue::Version::greaterThanEqual("6.0.0")) {
std::cerr << "Rogue >= 6.0.0 is required\n";
return 1;
}
// Throws rogue::GeneralError if requirement is not met.
rogue::Version::minVersion("6.0.0");
return 0;
}
#include "rogue/Version.h"
#include "rogue/GeneralError.h"
#include <iostream>
int main() {
try {
rogue::Version::maxVersion("7.0.0");
rogue::Version::exactVersion("6.3.0");
} catch (const rogue::GeneralError& e) {
std::cerr << "Version check failed: " << e.what() << "\n";
return 1;
}
return 0;
}