diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,5 @@ dist/ *.egg-info version.txt -swh/lister/_version.py .tox/ .mypy_cache/ diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ tests_require=parse_requirements('test'), setup_requires=['vcversioner'], extras_require={'testing': parse_requirements('test')}, - vcversioner={'version_module_paths': ['swh/lister/_version.py']}, + vcversioner={}, include_package_data=True, entry_points=''' [swh.cli.subcommands] diff --git a/swh/lister/__init__.py b/swh/lister/__init__.py --- a/swh/lister/__init__.py +++ b/swh/lister/__init__.py @@ -10,6 +10,12 @@ logger = logging.getLogger(__name__) +try: + __version__ = pkg_resources.get_distribution('swh.lister').version +except pkg_resources.DistributionNotFound: + __version__ = 'devel' + + LISTERS = {entry_point.name.split('.', 1)[1]: entry_point for entry_point in pkg_resources.iter_entry_points('swh.workers') if entry_point.name.split('.', 1)[0] == 'lister'} diff --git a/swh/lister/core/lister_transports.py b/swh/lister/core/lister_transports.py --- a/swh/lister/core/lister_transports.py +++ b/swh/lister/core/lister_transports.py @@ -14,10 +14,7 @@ from typing import Optional, Union -try: - from swh.lister._version import __version__ -except ImportError: - __version__ = 'devel' +from swh.lister import __version__ from .abstractattribute import AbstractAttribute from .lister_base import FetchError