blob: 024fca1a1874510c88833a6e33f343fd6eeccd69 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
from nsploit.arch import *
from nsploit.until import *
# Shout out: https://stackoverflow.com/questions/67085041
def __extract_version():
import importlib.metadata
from contextlib import suppress
from pathlib import Path
with suppress(FileNotFoundError, StopIteration):
pyproject = Path(__file__).parent.parent / "pyproject.toml"
with open(pyproject, "r") as f:
option = [ line for line in f if line.startswith("version") ]
version = next(iter(option)).split("=")[1].strip("'\"\n ")
return f"{version}-uninstalled"
return importlib.metadata.version(__package__ or __name__)
__version__ = f"v{__extract_version()}"
|