Skip to content

Commit

Permalink
mpflash: chore - replace use of pkg_resources
Browse files Browse the repository at this point in the history
Signed-off-by: Jos Verlinde <[email protected]>
  • Loading branch information
Josverl committed Jun 24, 2024
1 parent 66ff211 commit 51a6027
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/mpflash/mpflash/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
from pathlib import Path
from typing import List

import pkg_resources
import platformdirs
from importlib.metadata import version

from mpflash.logger import log


def get_version():
name = __package__ or "mpflash"
try:
return pkg_resources.get_distribution(name).version
except pkg_resources.DistributionNotFound:
return "Package not found"
return version(name)


class MPtoolConfig:
Expand All @@ -32,16 +29,15 @@ class MPtoolConfig:
@property
def interactive(self):
# No interactions in CI
if os.getenv('GITHUB_ACTIONS') == 'true':
if os.getenv("GITHUB_ACTIONS") == "true":
log.warning("Disabling interactive mode in CI")
return False
return self._interactive

@interactive.setter
def interactive(self, value:bool):
def interactive(self, value: bool):
self._interactive = value



config = MPtoolConfig()
__version__ = get_version()

0 comments on commit 51a6027

Please sign in to comment.