From 61ee39b1bd9eb93c7b97b7cd58c74e88e5edb6d6 Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Fri, 12 Jul 2024 09:59:24 +0300 Subject: [PATCH] Require Python package version to be equal to the REPL one While we keep them in the same repo and version them synchronously it works. Local version of the Python package doesn't intervene to the check because PEP440 requires it to be compatible with a public version. --- repl/src/metta_shim.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/repl/src/metta_shim.rs b/repl/src/metta_shim.rs index b003e09e9..0ded3a402 100644 --- a/repl/src/metta_shim.rs +++ b/repl/src/metta_shim.rs @@ -95,23 +95,7 @@ pub mod metta_interface_mod { fn required_hyperon_version() -> String { const PACKAGE_VERSION: &str = env!("CARGO_PKG_VERSION"); - - fn comparator(op: semver::Op, ver: &semver::Version) -> semver::Comparator { - semver::Comparator{ - op, - major: ver.major, - minor: Some(ver.minor), - patch: Some(0), - pre: semver::Prerelease::EMPTY, - } - } - - let mut ver = semver::Version::parse(PACKAGE_VERSION).unwrap(); - let lower_bound = comparator(semver::Op::GreaterEq, &ver); - ver.minor = ver.minor + 1; - let upper_bound = comparator(semver::Op::Less, &ver); - let req = semver::VersionReq{ comparators: vec![lower_bound, upper_bound] }; - req.to_string() + format!("=={PACKAGE_VERSION}") } pub fn init_common_env(working_dir: PathBuf, include_paths: Vec) -> Result {