Use pkg_resources to get the package version instead of vcversioner

This commit is contained in:
Nicolas Dandrimont 2019-11-21 18:23:20 +01:00
parent af04129d79
commit 62dc4dc257
5 changed files with 14 additions and 6 deletions

1
.gitignore vendored
View file

@ -9,6 +9,5 @@ build/
dist/
*.egg-info
version.txt
swh/lister/_version.py
.tox/
.mypy_cache/

View file

@ -48,7 +48,7 @@ setup(
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]

View file

@ -10,6 +10,12 @@ import pkg_resources
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'}

View file

@ -14,10 +14,7 @@ import xmltodict
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

View file

@ -12,6 +12,7 @@ import requests_mock
from sqlalchemy import create_engine
from typing import Any, Callable, Optional, Pattern, Type, Union
import swh.lister
from swh.lister.core.abstractattribute import AbstractAttribute
from swh.lister.tests.test_utils import init_db
@ -20,6 +21,11 @@ def noop(*args, **kwargs):
pass
def test_version_generation():
assert swh.lister.__version__ != 'devel', \
"Make sure swh.lister is installed (e.g. pip install -e .)"
class HttpListerTesterBase(abc.ABC):
"""Testing base class for listers.
This contains methods for both :class:`HttpSimpleListerTester` and