mirror of
https://github.com/imartinez/privateGPT.git
synced 2026-07-16 17:00:12 +00:00
chore(build): copy version.txt
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from importlib.metadata import PackageNotFoundError, version
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def get_version() -> str:
|
||||
with open("version.txt", "r+") as version_file:
|
||||
try:
|
||||
return version("private-gpt")
|
||||
except PackageNotFoundError:
|
||||
version_file = Path(__file__).resolve().parents[2] / "version.txt"
|
||||
try:
|
||||
release_version = version_file.read()
|
||||
version_file.close()
|
||||
return release_version
|
||||
except OSError as e:
|
||||
raise ImportError("Version file not found") from e
|
||||
return version_file.read_text(encoding="utf-8").strip()
|
||||
except OSError as exc:
|
||||
raise ImportError("Version metadata not found") from exc
|
||||
|
||||
@@ -348,6 +348,7 @@ packages = ["private_gpt"]
|
||||
|
||||
[tool.hatch.build.targets.wheel.force-include]
|
||||
"settings.yaml" = "settings.yaml"
|
||||
"version.txt" = "version.txt"
|
||||
"ui" = "ui"
|
||||
"scripts" = "scripts"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user