Compare commits
No commits in common. "ac41bc7fb60d50462bbff1da96c9d92982db6336" and "b5c898035ad336a33bdca05146374ee696a5fc84" have entirely different histories.
ac41bc7fb6
...
b5c898035a
@ -17,9 +17,10 @@ def main():
|
||||
help='userconfig2.cfg config file',
|
||||
dest='file', action='store')
|
||||
cmdline = parser.parse_args()
|
||||
cfg = Conf(cmdline.file)
|
||||
debug = Debug()
|
||||
debug.set_verbose(cmdline.verbose)
|
||||
cfg = Conf(filename=cmdline.file, debug=debug)
|
||||
cfg.set_debug(debug)
|
||||
uc = Userconfig(cfg)
|
||||
|
||||
cfg.debug.stdout(f"Verbose level is {cfg.debug.get_verbose()}", 1)
|
||||
|
@ -14,6 +14,3 @@ userconfig = "cli:main"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = [ "userconfig", "cli" ]
|
||||
|
||||
[tool.setuptools.data-files]
|
||||
"etc" = [ "userconfig2.conf" ]
|
||||
|
6
userconfig.cfg
Normal file
6
userconfig.cfg
Normal file
@ -0,0 +1,6 @@
|
||||
[Main]
|
||||
configdir = $HOME/.userconfig
|
||||
configfile = userconfig.cfg
|
||||
debug = 0
|
||||
stamp = %userconfig_generated 1.0%
|
||||
stampreplace = $userconfig_stamp$
|
@ -1,6 +1,5 @@
|
||||
import configparser
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
class Conf(object):
|
||||
@ -15,10 +14,7 @@ class Conf(object):
|
||||
if filename:
|
||||
filenames.append(filename)
|
||||
if not force_filename:
|
||||
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)
|
||||
if not ret:
|
||||
raise ValueError(f'Cannot open either configuration file: {",".join(filenames)}')
|
||||
|
@ -1,6 +0,0 @@
|
||||
[userconfig]
|
||||
configdir = %(HOME)s/.userconfig
|
||||
configfile = userconfig2.cfg
|
||||
debug = 0
|
||||
stamp = %%userconfig_generated 1.0%%
|
||||
stampreplace = $userconfig_stamp$
|
Loading…
Reference in New Issue
Block a user