From 663376fbbcc135488b8acb5195e9ff0c874d8d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Mon, 8 Mar 2010 09:26:05 +0000 Subject: [PATCH] Add split_version function to split version, release and build parts of a package version --- pisi/util.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pisi/util.py b/pisi/util.py index 668353cd..f038239c 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -618,6 +618,15 @@ def parse_delta_package_name(package_name): return name, buildFrom, buildTo +def split_version(package_version): + """Split version, release and build parts of a package version + + example: 1.0.3-5-2 -> (1.0.3, 5, 2) + """ + version, sep, release_and_build = package_version.partition("-") + release, sep, build = release_and_build.partition("-") + return version, release, build + def filter_latest_packages(package_paths): """ For a given pisi package paths list where there may also be multiple versions of the same package, filters only the latest versioned ones """