mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Fixed full Tcl version parsing in tests for pre-final versions.
This commit is contained in:
parent
333518e01d
commit
462c357d70
3 changed files with 23 additions and 27 deletions
|
@ -1,7 +1,6 @@
|
|||
import sys
|
||||
import re
|
||||
import tkinter
|
||||
import unittest
|
||||
from test.support import requires
|
||||
|
||||
class AbstractTkTest:
|
||||
|
||||
|
@ -63,14 +62,15 @@ def get_tk_patchlevel():
|
|||
global _tk_patchlevel
|
||||
if _tk_patchlevel is None:
|
||||
tcl = tkinter.Tcl()
|
||||
patchlevel = []
|
||||
for x in tcl.call('info', 'patchlevel').split('.'):
|
||||
try:
|
||||
x = int(x, 10)
|
||||
except ValueError:
|
||||
x = -1
|
||||
patchlevel.append(x)
|
||||
_tk_patchlevel = tuple(patchlevel)
|
||||
patchlevel = tcl.call('info', 'patchlevel')
|
||||
m = re.fullmatch(r'(\d+)\.(\d+)([ab.])(\d+)', patchlevel)
|
||||
major, minor, releaselevel, serial = m.groups()
|
||||
major, minor, serial = int(major), int(minor), int(serial)
|
||||
releaselevel = {'a': 'alpha', 'b': 'beta', '.': 'final'}[releaselevel]
|
||||
if releaselevel == 'final':
|
||||
_tk_patchlevel = major, minor, serial, releaselevel, 0
|
||||
else:
|
||||
_tk_patchlevel = major, minor, 0, releaselevel, serial
|
||||
return _tk_patchlevel
|
||||
|
||||
units = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue