From: Bruno Haible Date: Sun, 24 Mar 2024 21:46:44 +0000 (+0100) Subject: gnulib-tool.py: Bring the output into the right order. X-Git-Tag: v1.0~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99a74afb3c4bbe9db7329b10bdcb5ea93fad97a5;p=thirdparty%2Fgnulib.git gnulib-tool.py: Bring the output into the right order. * pygnulib/constants.py (force_output): New function. (execute): Flush stdout after printing the "executing ..." line. * pygnulib/GLTestDir.py (GLTestDir.execute, GLMegaTestDir.execute): Invoke force_output. * pygnulib/main.py (test, megatest): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 6953c94fe2..d6827684c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-03-24 Bruno Haible + + gnulib-tool.py: Bring the output into the right order. + * pygnulib/constants.py (force_output): New function. + (execute): Flush stdout after printing the "executing ..." line. + * pygnulib/GLTestDir.py (GLTestDir.execute, GLMegaTestDir.execute): + Invoke force_output. + * pygnulib/main.py (test, megatest): Likewise. + 2024-03-24 Bruno Haible nstrtime, c-nstrftime: Fix %c directive's result on glibc ≤ 2.30. diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index d6d6a9f954..aaff6d59ff 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -692,6 +692,7 @@ class GLTestDir(object): # Create autogenerated files. # Do not use "${AUTORECONF} --force --install", because it may invoke # autopoint, which brings in older versions of some of our .m4 files. + constants.force_output() os.chdir(self.testdir) # gettext if isfile(joinpath(m4base, 'gettext.m4')): @@ -853,6 +854,7 @@ class GLTestDir(object): os.chdir(self.testdir) if distributed_built_sources or tests_distributed_built_sources: + constants.force_output() sp.call('./configure') if distributed_built_sources: os.chdir(sourcebase) @@ -1040,6 +1042,7 @@ class GLMegaTestDir(object): file.write(emit) # Create autogenerated files. + constants.force_output() os.chdir(self.megatestdir) args = [UTILS['aclocal']] constants.execute(args, verbose) diff --git a/pygnulib/constants.py b/pygnulib/constants.py index c3a5aeae09..6ee7d4eb18 100644 --- a/pygnulib/constants.py +++ b/pygnulib/constants.py @@ -206,10 +206,19 @@ else: #=============================================================================== # Define global functions #=============================================================================== + +def force_output(): + '''This function is to be invoked before invoking external programs. + It initiates bringing the the contents of process-internal output buffers + to their respective destinations.''' + sys.stdout.flush() + sys.stderr.flush() + + def execute(args, verbose): '''Execute the given shell command.''' if verbose >= 0: - print("executing %s" % ' '.join(args)) + print("executing %s" % ' '.join(args), flush=True) try: # Try to run retcode = sp.call(args) except Exception as error: diff --git a/pygnulib/main.py b/pygnulib/main.py index eea92a925d..e90b9d00ae 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -1055,6 +1055,7 @@ def main(): config.setAuxDir(auxdir) testdir = classes.GLTestDir(config, destdir) testdir.execute() + constants.force_output() os.chdir(destdir) os.mkdir('build') os.chdir('build') @@ -1087,6 +1088,7 @@ def main(): config.setAuxDir(auxdir) testdir = classes.GLMegaTestDir(config, destdir) testdir.execute() + constants.force_output() os.chdir(destdir) os.mkdir('build') os.chdir('build')