Refactoring & install with pyproject.toml #1

Merged
lysis merged 16 commits from toml into main 2024-03-30 10:16:16 +01:00
Showing only changes of commit ac41bc7fb6 - Show all commits

View File

@ -1,5 +1,6 @@
import configparser import configparser
import os import os
import sys
class Conf(object): class Conf(object):
@ -14,7 +15,10 @@ class Conf(object):
if filename: if filename:
filenames.append(filename) filenames.append(filename)
if not force_filename: if not force_filename:
filenames.append(f'{os.environ.get("HOME")}/etc/userconfig2.conf') if os.path.isfile(f'{os.environ.get("HOME")}/etc/userconfig2.conf'):
filenames.append(f'{os.environ.get("HOME")}/etc/userconfig2.conf')
if os.path.isfile(f'{sys.prefix}/etc/userconfig2.conf'):
filenames.append(f'{sys.prefix}/etc/userconfig2.conf')
ret = self.set_filenames(filenames) ret = self.set_filenames(filenames)
if not ret: if not ret:
raise ValueError(f'Cannot open either configuration file: {",".join(filenames)}') raise ValueError(f'Cannot open either configuration file: {",".join(filenames)}')