mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2024-09-20 15:26:02 +08:00
23 lines
684 B
Python
23 lines
684 B
Python
import os
|
|
|
|
# Define an empty version_info tuple
|
|
__version_info__ = ()
|
|
|
|
# Get the path to the project directory
|
|
project_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
# Get the path to the VERSION file
|
|
version_file_path = os.path.join(project_dir, "..", "VERSION")
|
|
|
|
# Read the version from the file
|
|
with open(version_file_path) as f:
|
|
version_str = f.read().strip()
|
|
|
|
# Get only the first 3 digits
|
|
version_str_split = version_str.rsplit("-", 1)[0]
|
|
# Convert the version string to a tuple of integers
|
|
__version_info__ = tuple(map(int, version_str_split.split(".")))
|
|
|
|
# Define the version string using the version_info tuple
|
|
__version__ = ".".join(str(i) for i in __version_info__)
|