IDK :) userman or smt.. and inital commit

This commit is contained in:
2026-05-18 00:46:02 +02:00
commit 5a5b1a190b
14 changed files with 336 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import configparser
import platform
from pathlib import Path
CONFIG_FILE = Path.home() / ".config/userman/userman.conf"
def load_config():
config = configparser.ConfigParser(allow_no_value=True)
config.read(str(CONFIG_FILE))
options = config["options"] if "options" in config else {}
return {
"db_path": Path(options.get("DBPath", "~/.local/share/userman/db")).expanduser(),
"cache_dir": Path(options.get("CacheDir", "~/.cache/userman/pkg")).expanduser(),
"gpg_dir": Path(options.get("GPGDir", "~/.config/userman/gnupg")).expanduser(),
"hook_dir": Path(options.get("HookDir", "~/.config/userman/hooks")).expanduser(),
"log_file": Path(options.get("LogFile", "~/.local/share/userman/pacman.log")).expanduser(),
"root_dir": Path(options.get("RootDir", "~")).expanduser(),
"arch": options.get("Architecture", "auto").replace("auto", platform.machine()),
}
def get_repos() -> dict:
config = configparser.ConfigParser(allow_no_value=True)
config.read(str(CONFIG_FILE))
return {
section: config[section]["server"]
for section in config.sections()
if section.lower() != "options" and "server" in config[section]
}