From 28609feee971fb67e4fede0a258039392d7ede95 Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer <sebastien.luttringer@smartjog.com> Date: Thu, 15 Dec 2011 12:45:50 +0100 Subject: [PATCH] add is_version in tools --- installsystems/tools.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/installsystems/tools.py b/installsystems/tools.py index c15e189..f69588c 100644 --- a/installsystems/tools.py +++ b/installsystems/tools.py @@ -505,6 +505,13 @@ def chroot(path, shell="/bin/bash", mount=True): # revert preparation of chroot unprepare_chroot(path, mount) +def is_version(version): + ''' + Check if version is valid + ''' + if re.match("^(\d+)(?:([-~+]).*)?$", version) is None: + raise TypeError("Invalid version format %s" % buf) + def compare_versions(v1, v2): ''' This function compare version :param v1: and version :param v2: -- GitLab