Show More
@@ -1037,14 +1037,27 b' def versiontuple(v=None, n=4):' | |||||
1037 | (3, 9, None) |
|
1037 | (3, 9, None) | |
1038 | >>> versiontuple(v, 4) |
|
1038 | >>> versiontuple(v, 4) | |
1039 | (3, 9, None, 'rc+2-02a8fea4289b') |
|
1039 | (3, 9, None, 'rc+2-02a8fea4289b') | |
|
1040 | ||||
|
1041 | >>> versiontuple(b'4.6rc0') | |||
|
1042 | (4, 6, None, 'rc0') | |||
|
1043 | >>> versiontuple(b'4.6rc0+12-425d55e54f98') | |||
|
1044 | (4, 6, None, 'rc0+12-425d55e54f98') | |||
|
1045 | >>> versiontuple(b'.1.2.3') | |||
|
1046 | (None, None, None, '.1.2.3') | |||
|
1047 | >>> versiontuple(b'12.34..5') | |||
|
1048 | (12, 34, None, '..5') | |||
|
1049 | >>> versiontuple(b'1.2.3.4.5.6') | |||
|
1050 | (1, 2, 3, '.4.5.6') | |||
1040 | """ |
|
1051 | """ | |
1041 | if not v: |
|
1052 | if not v: | |
1042 | v = version() |
|
1053 | v = version() | |
1043 | parts = remod.split('[\+-]', v, 1) |
|
1054 | m = remod.match(br'(\d+(?:\.\d+){,2})[\+-]?(.*)', v) | |
1044 |
if |
|
1055 | if not m: | |
1045 |
vparts, extra = |
|
1056 | vparts, extra = '', v | |
|
1057 | elif m.group(2): | |||
|
1058 | vparts, extra = m.groups() | |||
1046 | else: |
|
1059 | else: | |
1047 |
vparts, extra = |
|
1060 | vparts, extra = m.group(1), None | |
1048 |
|
1061 | |||
1049 | vints = [] |
|
1062 | vints = [] | |
1050 | for i in vparts.split('.'): |
|
1063 | for i in vparts.split('.'): |
General Comments 0
You need to be logged in to leave comments.
Login now