From 002349f2900725c1e435a4685048aec26f0860af Mon Sep 17 00:00:00 2001 From: James Cameron Date: Mon, 17 Jul 2017 17:39:31 +1000 Subject: [PATCH] NormalizedVersion - accept ~ as version separator Bundle versions are often described as being decimal floats e.g. 1.2, but they also accept more than one dot, and a suffix after a dash, e.g. 1.2.3-peru Debian project and Ubuntu often use ~ for modified sources to comply with distribution policy (~dfsg), or developer builds. The dist_source target for setup.py does not work with a version suffix like ~dfsg, requiring a manual step to rename the file. Adjust the regular expression to accept the ~ form. --- src/sugar3/bundle/bundleversion.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sugar3/bundle/bundleversion.py b/src/sugar3/bundle/bundleversion.py index 972b8e1b..31b71b62 100644 --- a/src/sugar3/bundle/bundleversion.py +++ b/src/sugar3/bundle/bundleversion.py @@ -32,7 +32,7 @@ VERSION_RE = re.compile(r''' (?P\d+) # minimum 'N' (?P(?:\.\d+)*) # any number of extra '.N' segments (?: - (?P\-[a-zA-Z]*) # ignore any string in the comparison + (?P[\-\~].[a-zA-Z]*) # ignore any string in the comparison )? $''', re.VERBOSE) @@ -45,6 +45,7 @@ class NormalizedVersion(object): 1.2 1.2.3 1.2.3-peru + 1.2.3~dfsg Bad: 1.2peru # must be separated with -