def parse_legacy(version='Version 1.99.0 (2011-09-19 08:23:26)'):
 re_version = re.compile('[^\\d]+ (\\d+)\\.(\\d+)\\.(\\d+)\\s*\\((?P<datetime>.+?)\\)\\s*(?P<type>[a-z]+)?')
 m = re_version.match(version)
 (a, b, c) = (int(m.group(1)), int(m.group(2)), int(m.group(3)))
 pre_release = (m.group('type') or 'dev')
 build = datetime.datetime.strptime(m.group('datetime'), '%Y-%m-%d %H:%M:%S')
 return (a, b, c, pre_release, build)

def parse_legacy ( version = 'Version 1.99.0 (2011-09-19 08:23:26)' ) : re_version = re . compile ( '[^\\d]+ (\\d+)\\.(\\d+)\\.(\\d+)\\s*\\((?P<datetime>.+?)\\)\\s*(?P<type>[a-z]+)?' ) m = re_version . match ( version ) ( a , b , c ) = ( int ( m . group ( 1 ) ) , int ( m . group ( 2 ) ) , int ( m . group ( 3 ) ) ) pre_release = ( m . group ( 'type' ) or 'dev' ) build = datetime . datetime . strptime ( m . group ( 'datetime' ) , '%Y-%m-%d %H:%M:%S' ) return ( a , b , c , pre_release , build )
parses "legacy" version string args: version: the version string returns: tuple: major .