Skip to content

Commit

Permalink
Make version.py independent (#234)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
innerlee and dreamerlin authored Oct 8, 2020
1 parent 94895ec commit a26d5f9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
12 changes: 7 additions & 5 deletions mmaction/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import mmcv
from mmcv import digit_version

from .version import __version__, short_version
from .version import __version__

mmcv_minimum_version = '1.1.1'
mmcv_maximum_version = '1.2'
mmcv_version = digit_version(mmcv.__version__)

assert digit_version(mmcv_minimum_version) <= mmcv_version, \
f'MMCV=={mmcv.__version__} is used but incompatible. ' \
f'Please install mmcv>={mmcv_minimum_version}.'
assert (digit_version(mmcv_minimum_version) <= mmcv_version
<= digit_version(mmcv_maximum_version)), \
f'MMCV=={mmcv.__version__} is used but incompatible. ' \
f'Please install mmcv>={mmcv_minimum_version}, <={mmcv_maximum_version}.'

__all__ = ['__version__', 'short_version']
__all__ = ['__version__']
15 changes: 13 additions & 2 deletions mmaction/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Copyright (c) Open-MMLab. All rights reserved.
from mmcv import parse_version_info

__version__ = '0.7.0'
short_version = __version__


def parse_version_info(version_str):
version_info = []
for x in version_str.split('.'):
if x.isdigit():
version_info.append(int(x))
elif x.find('rc') != -1:
patch_version = x.split('rc')
version_info.append(int(patch_version[0]))
version_info.append(f'rc{patch_version[1]}')
return tuple(version_info)


version_info = parse_version_info(__version__)
11 changes: 3 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ def readme():
def get_version():
with open(version_file, 'r') as f:
exec(compile(f.read(), version_file, 'exec'))
import sys
# return short version for sdist
if 'sdist' in sys.argv or 'bdist_wheel' in sys.argv:
return locals()['short_version']
else:
return locals()['__version__']
return locals()['__version__']


def parse_requirements(fname='requirements.txt', with_version=True):
Expand Down Expand Up @@ -109,15 +104,15 @@ def gen_packages_items():
maintainer='MMAction2 Authors',
maintainer_email='[email protected]',
packages=find_packages(exclude=('configs', 'tools', 'demo')),
package_data={'mmaction.ops': ['*/*.so']},
keywords='computer vision, action understanding',
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
url='https://github.com/open-mmlab/mmaction2',
license='Apache License 2.0',
Expand Down

0 comments on commit a26d5f9

Please sign in to comment.