Skip to content

Commit a26d5f9

Browse files
innerleedreamerlin
andauthored
Make version.py independent (#234)
* make version.py independent * upper bound mmcv again * tiny * tiny * use and remove * remove short_version in setup.py * update setup.py * update setup.py * add unittest for parse_version_info * remove unittest Co-authored-by: dreamerlin <[email protected]>
1 parent 94895ec commit a26d5f9

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

mmaction/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import mmcv
22
from mmcv import digit_version
33

4-
from .version import __version__, short_version
4+
from .version import __version__
55

66
mmcv_minimum_version = '1.1.1'
7+
mmcv_maximum_version = '1.2'
78
mmcv_version = digit_version(mmcv.__version__)
89

9-
assert digit_version(mmcv_minimum_version) <= mmcv_version, \
10-
f'MMCV=={mmcv.__version__} is used but incompatible. ' \
11-
f'Please install mmcv>={mmcv_minimum_version}.'
10+
assert (digit_version(mmcv_minimum_version) <= mmcv_version
11+
<= digit_version(mmcv_maximum_version)), \
12+
f'MMCV=={mmcv.__version__} is used but incompatible. ' \
13+
f'Please install mmcv>={mmcv_minimum_version}, <={mmcv_maximum_version}.'
1214

13-
__all__ = ['__version__', 'short_version']
15+
__all__ = ['__version__']

mmaction/version.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# Copyright (c) Open-MMLab. All rights reserved.
2-
from mmcv import parse_version_info
32

43
__version__ = '0.7.0'
5-
short_version = __version__
4+
5+
6+
def parse_version_info(version_str):
7+
version_info = []
8+
for x in version_str.split('.'):
9+
if x.isdigit():
10+
version_info.append(int(x))
11+
elif x.find('rc') != -1:
12+
patch_version = x.split('rc')
13+
version_info.append(int(patch_version[0]))
14+
version_info.append(f'rc{patch_version[1]}')
15+
return tuple(version_info)
16+
617

718
version_info = parse_version_info(__version__)

setup.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ def readme():
1313
def get_version():
1414
with open(version_file, 'r') as f:
1515
exec(compile(f.read(), version_file, 'exec'))
16-
import sys
17-
# return short version for sdist
18-
if 'sdist' in sys.argv or 'bdist_wheel' in sys.argv:
19-
return locals()['short_version']
20-
else:
21-
return locals()['__version__']
16+
return locals()['__version__']
2217

2318

2419
def parse_requirements(fname='requirements.txt', with_version=True):
@@ -109,15 +104,15 @@ def gen_packages_items():
109104
maintainer='MMAction2 Authors',
110105
maintainer_email='[email protected]',
111106
packages=find_packages(exclude=('configs', 'tools', 'demo')),
112-
package_data={'mmaction.ops': ['*/*.so']},
107+
keywords='computer vision, action understanding',
113108
classifiers=[
114109
'Development Status :: 4 - Beta',
115110
'License :: OSI Approved :: Apache Software License',
116111
'Operating System :: OS Independent',
117112
'Programming Language :: Python :: 3',
118-
'Programming Language :: Python :: 3.5',
119113
'Programming Language :: Python :: 3.6',
120114
'Programming Language :: Python :: 3.7',
115+
'Programming Language :: Python :: 3.8',
121116
],
122117
url='https://github.com/open-mmlab/mmaction2',
123118
license='Apache License 2.0',

0 commit comments

Comments
 (0)