bump version to 0.6.0 (#62)
* fix lint * fix version path type * del short_version * setup: del ops; add python3.8 * del useless requirements * setup: remove extra_requirements * setup: totally remove build_requests * setup: change to valid emailpull/64/head
parent
c00ee6a876
commit
d369645e23
|
@ -105,7 +105,6 @@ venv.bak/
|
|||
.mypy_cache/
|
||||
|
||||
# custom
|
||||
mmcls/version.py
|
||||
data
|
||||
.vscode
|
||||
.idea
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
0.1.0
|
|
@ -1,3 +1,3 @@
|
|||
from .version import __version__, short_version
|
||||
from .version import __version__
|
||||
|
||||
__all__ = ['__version__', 'short_version']
|
||||
__all__ = ['__version__']
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Copyright (c) Open-MMLab. All rights reserved.
|
||||
|
||||
__version__ = '0.6.0'
|
||||
|
||||
|
||||
def parse_version_info(version_str):
|
||||
"""Parse a version string into a tuple.
|
||||
Args:
|
||||
version_str (str): The version string.
|
||||
Returns:
|
||||
tuple[int | str]: The version info, e.g., "1.3.0" is parsed into
|
||||
(1, 3, 0), and "2.0.0rc1" is parsed into (2, 0, 0, 'rc1').
|
||||
"""
|
||||
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__)
|
||||
|
||||
__all__ = ['__version__', 'version_info', 'parse_version_info']
|
|
@ -1 +0,0 @@
|
|||
numpy
|
125
setup.py
125
setup.py
|
@ -1,6 +1,3 @@
|
|||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
||||
|
@ -10,71 +7,9 @@ def readme():
|
|||
return content
|
||||
|
||||
|
||||
version_file = 'mmcls/version.py'
|
||||
|
||||
|
||||
def get_git_hash():
|
||||
|
||||
def _minimal_ext_cmd(cmd):
|
||||
# construct minimal environment
|
||||
env = {}
|
||||
for k in ['SYSTEMROOT', 'PATH', 'HOME']:
|
||||
v = os.environ.get(k)
|
||||
if v is not None:
|
||||
env[k] = v
|
||||
# LANGUAGE is used on win32
|
||||
env['LANGUAGE'] = 'C'
|
||||
env['LANG'] = 'C'
|
||||
env['LC_ALL'] = 'C'
|
||||
out = subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
|
||||
return out
|
||||
|
||||
try:
|
||||
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
|
||||
sha = out.strip().decode('ascii')
|
||||
except OSError:
|
||||
sha = 'unknown'
|
||||
|
||||
return sha
|
||||
|
||||
|
||||
def get_hash():
|
||||
if os.path.exists('.git'):
|
||||
sha = get_git_hash()[:7]
|
||||
elif os.path.exists(version_file):
|
||||
try:
|
||||
from mmcls.version import __version__
|
||||
sha = __version__.split('+')[-1]
|
||||
except ImportError:
|
||||
raise ImportError('Unable to get git version')
|
||||
else:
|
||||
sha = 'unknown'
|
||||
|
||||
return sha
|
||||
|
||||
|
||||
def write_version_py():
|
||||
content = """# GENERATED VERSION FILE
|
||||
# TIME: {}
|
||||
__version__ = '{}'
|
||||
short_version = '{}'
|
||||
version_info = ({})
|
||||
"""
|
||||
sha = get_hash()
|
||||
with open('mmcls/VERSION', 'r') as f:
|
||||
SHORT_VERSION = f.read().strip()
|
||||
VERSION_INFO = ', '.join(SHORT_VERSION.split('.'))
|
||||
VERSION = SHORT_VERSION + '+' + sha
|
||||
|
||||
version_file_str = content.format(time.asctime(), VERSION, SHORT_VERSION,
|
||||
VERSION_INFO)
|
||||
with open(version_file, 'w') as f:
|
||||
f.write(version_file_str)
|
||||
|
||||
|
||||
def get_version():
|
||||
with open(version_file, 'r') as f:
|
||||
version_file = 'mmcls/version.py'
|
||||
with open(version_file, 'r', encoding='utf-8') as f:
|
||||
exec(compile(f.read(), version_file, 'exec'))
|
||||
return locals()['__version__']
|
||||
|
||||
|
@ -155,35 +90,27 @@ def parse_requirements(fname='requirements.txt', with_version=True):
|
|||
return packages
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
write_version_py()
|
||||
setup(
|
||||
name='mmcls',
|
||||
version=get_version(),
|
||||
description='OpenMMLab Image Classification Toolbox and Benchmark',
|
||||
long_description=readme(),
|
||||
author='OpenMMLab',
|
||||
author_email='yangleidev@gmail.com',
|
||||
keywords='computer vision, image classification',
|
||||
url='https://github.com/open-mmlab/mmclassification',
|
||||
packages=find_packages(exclude=('configs', 'tools', 'demo')),
|
||||
package_data={'mmcls.ops': ['*/*.so']},
|
||||
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',
|
||||
],
|
||||
license='Apache License 2.0',
|
||||
setup_requires=parse_requirements('requirements/build.txt'),
|
||||
tests_require=parse_requirements('requirements/tests.txt'),
|
||||
install_requires=parse_requirements('requirements/runtime.txt'),
|
||||
extras_require={
|
||||
'all': parse_requirements('requirements.txt'),
|
||||
'tests': parse_requirements('requirements/tests.txt'),
|
||||
'build': parse_requirements('requirements/build.txt'),
|
||||
},
|
||||
zip_safe=False)
|
||||
setup(
|
||||
name='mmcls',
|
||||
version=get_version(),
|
||||
description='OpenMMLab Image Classification Toolbox and Benchmark',
|
||||
long_description=readme(),
|
||||
author='OpenMMLab',
|
||||
author_email='openmmlab@gmail.com',
|
||||
keywords='computer vision, image classification',
|
||||
url='https://github.com/open-mmlab/mmclassification',
|
||||
packages=find_packages(exclude=('configs', 'tools', 'demo')),
|
||||
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',
|
||||
],
|
||||
license='Apache License 2.0',
|
||||
tests_require=parse_requirements('requirements/tests.txt'),
|
||||
install_requires=parse_requirements('requirements/runtime.txt'),
|
||||
zip_safe=False)
|
||||
|
|
Loading…
Reference in New Issue