]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
gnulib-tool.py: Bring the output into the right order.
authorBruno Haible <bruno@clisp.org>
Sun, 24 Mar 2024 21:46:44 +0000 (22:46 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 24 Mar 2024 21:46:44 +0000 (22:46 +0100)
* 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.

ChangeLog
pygnulib/GLTestDir.py
pygnulib/constants.py
pygnulib/main.py

index 6953c94fe204d4ff1548d6c88e3ffe2bc3bd2fb2..d6827684c781e57379da685712a8a1ef81a3c506 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-24  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        nstrtime, c-nstrftime: Fix %c directive's result on glibc ≤ 2.30.
index d6d6a9f95412709cbe9363edadfaff0e3faebb65..aaff6d59ffcc1e0f74f571a35ab275aa8f580b06 100644 (file)
@@ -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)
index c3a5aeae094237949f619a3853df98f20af40fbd..6ee7d4eb18d9ae8f8e993856d146e9530bfdbfd7 100644 (file)
@@ -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:
index eea92a925d7917b5ef096f0ef5f146503aa7bf9b..e90b9d00aef7a1137b6cb9a1768a384221ac08fb 100644 (file)
@@ -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')