mirror of
https://github.com/open-mmlab/mim.git
synced 2025-06-03 14:59:11 +08:00
[Enhancement] Add version.py (#24)
* [Enhancement] Add version.py * [Enhancement] Add version.py
This commit is contained in:
parent
443afe60c2
commit
210e55fb48
10
docs/conf.py
10
docs/conf.py
@ -25,9 +25,17 @@ sys.path.insert(0, os.path.abspath('..'))
|
|||||||
project = 'mim'
|
project = 'mim'
|
||||||
copyright = '2021, openmmlab'
|
copyright = '2021, openmmlab'
|
||||||
author = 'MIM Authors'
|
author = 'MIM Authors'
|
||||||
|
version_file = '../mim/version.py'
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
with open(version_file, 'r') as f:
|
||||||
|
exec(compile(f.read(), version_file, 'exec'))
|
||||||
|
return locals()['__version__']
|
||||||
|
|
||||||
|
|
||||||
# The full version, including alpha/beta/rc tags
|
# The full version, including alpha/beta/rc tags
|
||||||
release = '0.1.0'
|
release = get_version()
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------------
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
||||||
|
18
mim/version.py
Normal file
18
mim/version.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright (c) Open-MMLab. All rights reserved.
|
||||||
|
|
||||||
|
__version__ = '0.1.0'
|
||||||
|
|
||||||
|
|
||||||
|
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__)
|
14
setup.py
14
setup.py
@ -1,13 +1,23 @@
|
|||||||
from setuptools import find_packages, setup # type: ignore
|
from setuptools import find_packages, setup # type: ignore
|
||||||
|
|
||||||
|
version_file = 'mim/version.py'
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
with open(version_file, 'r') as f:
|
||||||
|
exec(compile(f.read(), version_file, 'exec'))
|
||||||
|
return locals()['__version__']
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='openmim',
|
name='openmim',
|
||||||
version='0.1.0',
|
version=get_version(),
|
||||||
description='MIM Install OpenMMLab packages',
|
description='MIM Installs OpenMMLab packages',
|
||||||
author='MIM Authors',
|
author='MIM Authors',
|
||||||
author_email='openmmlab@gmail.com',
|
author_email='openmmlab@gmail.com',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
url='https://github.com/open-mmlab/mim',
|
||||||
python_requires='>=3.6',
|
python_requires='>=3.6',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'Click==7.1.2',
|
'Click==7.1.2',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user