mirror of
https://github.com/aclist/dztui.git
synced 2026-08-26 01:37:18 +02:00
24 lines
467 B
Python
24 lines
467 B
Python
import os
|
|
import sys
|
|
|
|
from importlib import metadata
|
|
from pathlib import Path
|
|
|
|
from dzgui.const.constants import APP_NAME_LOWER
|
|
|
|
def is_prefix_writeable() -> bool:
|
|
prefix = sys.prefix
|
|
path = Path(prefix)
|
|
file = path / ".is_writeable"
|
|
try:
|
|
with open(file, "w") as f:
|
|
f.write("")
|
|
os.remove(file)
|
|
except OSError:
|
|
return False
|
|
return True
|
|
|
|
|
|
def get_version() -> str:
|
|
return metadata.version(APP_NAME_LOWER)
|