Skip to content

Commit

Permalink
use digit_version from mmcv
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamerlin committed Sep 17, 2020
1 parent 9abe85a commit 0cf677e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
**Improvements**
- Support to run a demo with a video url ([#165](https://github.com/open-mmlab/mmaction2/pull/165))
- Remove git hash in `__version__` ([#189](https://github.com/open-mmlab/mmaction2/pull/189))
- Check MMCV version ([#189](https://github.com/open-mmlab/mmaction2/pull/189))
- Check mmcv version ([#189](https://github.com/open-mmlab/mmaction2/pull/189))

**Bug Fixes**

Expand Down
23 changes: 5 additions & 18 deletions mmaction/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
import mmcv
from mmcv import digit_version

from .version import __version__, short_version


def digit_version(version_str):
digit_version = []
for x in version_str.split('.'):
if x.isdigit():
digit_version.append(int(x))
elif x.find('rc') != -1:
patch_version = x.split('rc')
digit_version.append(int(patch_version[0]) - 1)
digit_version.append(int(patch_version[1]))
return digit_version


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


assert (mmcv_version >= digit_version(mmcv_minimum_version)
and 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}.'
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}.' # noqa: E501

__all__ = ['__version__', 'short_version']
15 changes: 0 additions & 15 deletions tests/test_version.py

This file was deleted.

0 comments on commit 0cf677e

Please # to comment.