docs(conf): replace pkg_resources with importlib

The doc is build with python 3.8, which includes the `importlib` API to
get the package version. Its use is recommended by `setuptools-scm` for
the doc.
This commit is contained in:
François Magimel 2022-01-19 11:16:42 +01:00 committed by Hasan Ramezani
parent f516aae4a6
commit a30c8bbfc0

View file

@ -9,7 +9,7 @@
import os import os
import sys import sys
from datetime import date from datetime import date
from pkg_resources import get_distribution from importlib.metadata import version
# -- Path setup -------------------------------------------------------------- # -- Path setup --------------------------------------------------------------
@ -31,7 +31,7 @@ project = 'django-auditlog'
author = 'Jan-Jelle Kester and contributors' author = 'Jan-Jelle Kester and contributors'
copyright = f'2013-{date.today().year}, {author}' copyright = f'2013-{date.today().year}, {author}'
release = get_distribution('django-auditlog').version release = version('django-auditlog')
# for example take major/minor # for example take major/minor
version = '.'.join(release.split('.')[:2]) version = '.'.join(release.split('.')[:2])