From fa2a1e1d3961c04efd4a2c92873e116fd540278c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 7 Feb 2021 11:00:26 -0800 Subject: [PATCH] log modified config files --- cue.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/cue.py b/cue.py index 09f6abc..a94da2a 100644 --- a/cue.py +++ b/cue.py @@ -13,6 +13,22 @@ import distutils.util logger = logging.getLogger(__name__) +# Keep track of all files we write/append for later logging +_realopen = open +_modified_files = set() +def open(fname, mode='r'): + F = _realopen(fname, mode) + if 'w' in mode or 'a' in mode: + _modified_files.add(os.path.normpath(os.path.abspath(fname))) + return F + +def log_modified(): + for fname in _modified_files: + with Folded(os.path.basename(fname), 'Contents of '+fname): + with open(fname, 'r') as F: + sys.stdout.write(F.read()) + sys.stdout.write(os.linesep) + def prepare_env(): '''HACK github actions yaml configuration doesn't allow @@ -230,6 +246,13 @@ def fold_end(tag, title): .format(ANSI_YELLOW, title, ANSI_RESET)) sys.stdout.flush() +class Folded(object): + def __init__(self, tag, title): + self.tag, self.title = tag, title + def __enter__(self): + fold_start(self.tag, self.title) + def __exit__(self,A,B,C): + fold_end(self.tag, self.title) homedir = curdir if 'HomeDrive' in os.environ: @@ -983,6 +1006,9 @@ PERL = C:/Strawberry/perl/bin/perl -CSD''' sys.stdout.flush() sp.check_call([cc, '--version']) + if logging.getLogger().isEnabledFor(logging.DEBUG): + log_modified() + if not building_base: fold_start('build.dependencies', 'Build missing/outdated dependencies') for mod in modules_to_compile: @@ -1009,7 +1035,6 @@ PERL = C:/Strawberry/perl/bin/perl -CSD''' with open(os.path.join(ci['cachedir'], 'RELEASE.local'), 'r') as f: print(f.read().strip()) - def build(args): setup_for_build(args) fold_start('build.module', 'Build the main module')