adjusted start/end debug output for functions, print directory name and end marker

This commit is contained in:
Marcus Stoegbauer 2024-03-30 21:40:58 +01:00
parent 4640a5edc3
commit 37954e432c
1 changed files with 6 additions and 8 deletions

View File

@ -23,7 +23,7 @@ class Userconfig:
:return: str :return: str
""" """
content = [] content = []
self._cfg.debug.stdout(" ================ build_file ===============", 1) self._cfg.debug.stdout(f" ================ build_file {destfile} ===============", 1)
if commentstring != "": if commentstring != "":
self._cfg.debug.stdout(" +++ commentstring found, adding header.", 3) self._cfg.debug.stdout(" +++ commentstring found, adding header.", 3)
content.append(commentstring + " " + self._cfg.get("stamp") + " " + time.strftime("%+") + "\n") content.append(commentstring + " " + self._cfg.get("stamp") + " " + time.strftime("%+") + "\n")
@ -54,7 +54,7 @@ class Userconfig:
fp.write(block) fp.write(block)
fp.write("\n") fp.write("\n")
fp.close() fp.close()
self._cfg.debug.stdout(" ================ build_file ===============", 1) self._cfg.debug.stdout(f" ================ done: build_file {destfile} ===============", 1)
return tempfilename return tempfilename
def process_all_files(self, destfiles, dir_config): def process_all_files(self, destfiles, dir_config):
@ -100,8 +100,7 @@ class Userconfig:
"""walks through directory, collecting all filenames, returns list of all filenames""" """walks through directory, collecting all filenames, returns list of all filenames"""
dirs = os.listdir(directory) dirs = os.listdir(directory)
ret = [] ret = []
self._cfg.debug.stdout(" ================ workconf ===============", 1) self._cfg.debug.stdout(f" ================ workconf {directory} ===============", 1)
self._cfg.debug.stdout(" Finding files in directory %s." % directory, 4)
for d in dirs: for d in dirs:
name = directory + "/" + d name = directory + "/" + d
if os.path.isdir(name): if os.path.isdir(name):
@ -112,7 +111,7 @@ class Userconfig:
continue continue
ret.append(name) ret.append(name)
self._cfg.debug.stdout(" +++ Found file %s in directory %s" % (name, directory), 4) self._cfg.debug.stdout(" +++ Found file %s in directory %s" % (name, directory), 4)
self._cfg.debug.stdout(" ================ workconf ===============", 1) self._cfg.debug.stdout(f" ================ done: workconf {directory} ===============", 1)
return ret return ret
def workdir(self, directory): def workdir(self, directory):
@ -120,8 +119,7 @@ class Userconfig:
then collect all filenames within this directory and return a dict of all files for this then collect all filenames within this directory and return a dict of all files for this
directory directory
""" """
self._cfg.debug.stdout(" ================ workdir ===============", 1) self._cfg.debug.stdout(f" ================ workdir {directory} ===============", 1)
self._cfg.debug.stdout(" Working on directory %s" % directory, 3)
# skip directory if no CONFIGFILE present # skip directory if no CONFIGFILE present
if not os.path.isfile(directory+"/"+self._cfg.get("configfile")): if not os.path.isfile(directory+"/"+self._cfg.get("configfile")):
self._cfg.debug.stdout(f' --- No file {self._cfg.get("configfile")} in {directory}, skipping.', 1) self._cfg.debug.stdout(f' --- No file {self._cfg.get("configfile")} in {directory}, skipping.', 1)
@ -171,5 +169,5 @@ class Userconfig:
f"{destfiles[destname]}", 4) f"{destfiles[destname]}", 4)
self._cfg.debug.stdout(" === workdir: %s, Files: %s" % (directory, str(destfiles)), 3) self._cfg.debug.stdout(" === workdir: %s, Files: %s" % (directory, str(destfiles)), 3)
self._cfg.debug.stdout(" ================ workdir ===============", 1) self._cfg.debug.stdout(f" ================ done: workdir {directory} ===============", 1)
return destfiles, dir_config return destfiles, dir_config