Skip to content

Commit

Permalink
Replace usage of pkg_resources.get_distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Feb 20, 2024
1 parent 35b449c commit 6b8aadd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions python/nav/buildconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
# pylint: disable=invalid-name
import os
import sysconfig
import pkg_resources

try:
from importlib import metadata as _impmeta
except ImportError:
import importlib_metadata as _impmeta


datadir = os.path.join(sysconfig.get_config_var('datarootdir'), 'nav')
localstatedir = os.path.join(datadir, 'var')
webrootdir = os.path.join(datadir, "www")
djangotmpldir = os.path.join(datadir, "templates")
docdir = os.path.join(datadir, "doc")


try:
VERSION = pkg_resources.get_distribution("nav").version
except pkg_resources.DistributionNotFound:
VERSION = _impmeta.version("nav")
except _impmeta.PackageNotFoundError:

Check warning on line 21 in python/nav/buildconf.py

View check run for this annotation

Codecov / codecov/patch

python/nav/buildconf.py#L21

Added line #L21 was not covered by tests
# If we're not installed, try to get the current version from Git tags
import setuptools_scm

Expand Down

0 comments on commit 6b8aadd

Please sign in to comment.