-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathcheck_pytest_version_compat.py
More file actions
59 lines (46 loc) · 1.93 KB
/
Copy pathcheck_pytest_version_compat.py
File metadata and controls
59 lines (46 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
from distutils.version import LooseVersion
import ubelt as ub
os.chdir(ub.expandpath('$HOME/code/pytest'))
info = ub.cmd('git tag')
tags = [t for t in info['out'].split('\n') if t]
tags = sorted(tags, key=LooseVersion)
has_ispytest = {}
language_classifiers = {}
for tag in ub.ProgIter(tags):
ub.cmd('git checkout {}'.format(tag))
info = ub.cmd('grep -I -ER _ispytest')
has_ispytest[tag] = len(info['out'].strip()) > 0
info = ub.cmd('grep -I -ER "Programming Language :: Python" setup.cfg')
language_classifiers[tag] = info['out']
for tag, flag in has_ispytest.items():
if flag:
break
print('First tag with _pytest = {!r}'.format(tag))
pythonversion_to_supported = ub.ddict(list)
for tag, clfs in language_classifiers.items():
if clfs != '':
for line in clfs.split('\n'):
pythonversion_to_supported[line.strip()].append(tag)
keys = [
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
]
for key in keys:
cands = pythonversion_to_supported[key]
if cands:
max_version = max(cands, key=LooseVersion)
print('key = {} max_version = {!r}'.format(key, max_version))
# key = Programming Language :: Python :: 2.7 max_version = '4.6.11'
# key = Programming Language :: Python :: 3.4 max_version = '4.6.11'
# key = Programming Language :: Python :: 3.5 max_version = '6.2.0.dev0'
# key = Programming Language :: Python :: 3.6 max_version = '6.3.0.dev0'
# key = Programming Language :: Python :: 3.7 max_version = '6.3.0.dev0'
# key = Programming Language :: Python :: 3.8 max_version = '6.3.0.dev0'
# key = Programming Language :: Python :: 3.9 max_version = '6.3.0.dev0'