You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
625 B
Python

import json
from pathlib import Path
__all__ = ["__version__"]
def _fetchVersion():
HERE = Path(__file__).parent.resolve()
for settings in HERE.rglob("package.json"):
try:
with settings.open() as f:
version = json.load(f)["version"]
return (
version.replace("-alpha.", "a")
.replace("-beta.", "b")
.replace("-rc.", "rc")
)
except FileNotFoundError:
pass
raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}")
__version__ = _fetchVersion()