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 Jan 5, 2024
1 parent 9efd879 commit 692a8ba
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:
# If we're not installed, try to get the current version from Git tags
import setuptools_scm

Expand Down

0 comments on commit 692a8ba

Please sign in to comment.