@@ -30,12 +30,12 @@ def _parse_version_tag(tag, config):
30
30
if len (match .groups ()) == 1 :
31
31
key = 1
32
32
else :
33
- key = ' version'
34
-
33
+ key = " version"
34
+
35
35
result = {
36
- ' version' : match .group (key ),
37
- ' prefix' : match .group (0 )[:match .start (key )],
38
- ' suffix' : match .group (0 )[match .end (key ):],
36
+ " version" : match .group (key ),
37
+ " prefix" : match .group (0 )[:match .start (key )],
38
+ " suffix" : match .group (0 )[match .end (key ):],
39
39
}
40
40
41
41
trace ("tag '%s' parsed to %s" % (tag , result ))
@@ -88,20 +88,21 @@ def tag_to_version(tag, config=None):
88
88
config = Configuration ()
89
89
90
90
tagdict = _parse_version_tag (tag , config )
91
- if not isinstance (tagdict , dict ) or not tagdict .get (' version' , None ):
91
+ if not isinstance (tagdict , dict ) or not tagdict .get (" version" , None ):
92
92
warnings .warn ("tag %r no version found" % (tag ,))
93
93
return None
94
94
95
- version = tagdict [' version' ]
95
+ version = tagdict [" version" ]
96
96
trace ("version pre parse" , version )
97
97
98
- if tagdict .get ('suffix' , '' ):
99
- warnings .warn ("tag %r will be stripped of its suffix '%s'" % (tag , tagdict ['suffix' ]))
98
+ if tagdict .get ("suffix" , "" ):
99
+ warnings .warn (
100
+ "tag %r will be stripped of its suffix '%s'" % (tag , tagdict ["suffix" ])
101
+ )
100
102
101
103
if VERSION_CLASS is not None :
102
104
version = pkg_parse_version (version )
103
105
trace ("version" , repr (version ))
104
-
105
106
return version
106
107
107
108
@@ -111,7 +112,12 @@ def tags_to_versions(tags, config=None):
111
112
:param tags: an iterable of tags
112
113
:param config: optional configuration object
113
114
"""
114
- return filter (None , map (lambda tag : tag_to_version (tag , config = config ), tags ))
115
+ result = []
116
+ for tag in tags :
117
+ tag = tag_to_version (tag , config = config )
118
+ if tag :
119
+ result .append (tag )
120
+ return result
115
121
116
122
117
123
class ScmVersion (object ):
@@ -176,9 +182,14 @@ def _parse_tag(tag, preformatted, config):
176
182
return tag
177
183
178
184
179
- def meta (tag , distance = None , dirty = False , node = None , preformatted = False , config = None , ** kw ):
185
+ def meta (
186
+ tag , distance = None , dirty = False , node = None , preformatted = False , config = None , ** kw
187
+ ):
180
188
if not config :
181
- warnings .warn ("meta invoked without explicit configuration, will use defaults where required." )
189
+ warnings .warn (
190
+ "meta invoked without explicit configuration,"
191
+ " will use defaults where required."
192
+ )
182
193
parsed_version = _parse_tag (tag , preformatted , config )
183
194
trace ("version" , tag , "->" , parsed_version )
184
195
assert parsed_version is not None , "cant parse version %s" % tag
0 commit comments