]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Follow gnulib-tool changes, part 48.
authorCollin Funk <collin.funk1@gmail.com>
Sat, 9 Mar 2024 04:59:16 +0000 (20:59 -0800)
committerBruno Haible <bruno@clisp.org>
Sat, 9 Mar 2024 09:48:48 +0000 (10:48 +0100)
Follow gnulib-tool change
2019-01-23  Bruno Haible  <bruno@clisp.org>
gnulib-tool: Support running testdirs on Android.

* pygnulib/GLError.py (GLError.__init__, GLError.__repr__): Add errno 20
to print an error if patching build-aux/test-driver fails.
* pygnulib/main.py (main): Likewise.
* pygnulib/GLTestDir.py (_patch_test_driver): New private function which
runs patch on build-aux/test-driver with build-aux/test-driver.diff.
(GLTestDir.execute, GLMegaTestDir.execute): Check for
build-aux/test-driver in each testdir and patch it after running
automake.

ChangeLog
gnulib-tool.py.TODO
pygnulib/GLError.py
pygnulib/GLTestDir.py
pygnulib/main.py

index 042fd868ebaf2536bba593dd5893ae3536b08654..10de1262c3b6a60a3f7f537f2ef17a1b6c48291f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-03-09  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Follow gnulib-tool changes, part 48.
+       Follow gnulib-tool change
+       2019-01-23  Bruno Haible  <bruno@clisp.org>
+       gnulib-tool: Support running testdirs on Android.
+       * pygnulib/GLError.py (GLError.__init__, GLError.__repr__): Add errno 20
+       to print an error if patching build-aux/test-driver fails.
+       * pygnulib/main.py (main): Likewise.
+       * pygnulib/GLTestDir.py (_patch_test_driver): New private function which
+       runs patch on build-aux/test-driver with build-aux/test-driver.diff.
+       (GLTestDir.execute, GLMegaTestDir.execute): Check for
+       build-aux/test-driver in each testdir and patch it after running
+       automake.
+
 2024-03-08  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool: Don't remove comments referencing @NMD@.
index 8918d58a8800a1969e99a45de63fb6241d38fdd3..7632991780e8003f67fe48ccbb6fa63e646eb02c 100644 (file)
@@ -431,18 +431,6 @@ Date:   Mon Nov 18 13:32:46 2019 +0100
 
 --------------------------------------------------------------------------------
 
-commit 425ee42259b04956aae20afc5204775ae6e79744
-Author: Bruno Haible <bruno@clisp.org>
-Date:   Wed Jan 23 05:11:54 2019 +0100
-
-    gnulib-tool: Support running testdirs on Android.
-
-    * build-aux/test-driver.diff: New file.
-    * gnulib-tool (func_create_testdir, func_create_megatestdir): Patch
-    build-aux/test-driver after running automake.
-
---------------------------------------------------------------------------------
-
 commit ce8a5edbc49dea0cb859207c2d063dbd3be0f96c
 Author: Bruno Haible <bruno@clisp.org>
 Date:   Fri Jan 4 19:34:19 2019 +0100
index 5c7420e8b1195339c2d8ef65c709b5f6981f5bd7..0fd1fcf3a152ed298faa37f467964e8a93b9d013 100644 (file)
@@ -61,6 +61,7 @@ class GLError(Exception):
          17: cannot update the given file: <file>
          18: module lacks a license: <module>
          19: could not create destination directory: <directory>
+         20: could not patch test-driver script
         errinfo: additional information'''
         self.errno = errno
         self.errinfo = errinfo
@@ -109,5 +110,7 @@ class GLError(Exception):
                 message = "module lacks a license: %s" % repr(errinfo)
             elif errno == 19:
                 message = "error when running subprocess: %s" % repr(errinfo)
+            elif errno == 20:
+                message = 'could not patch test-driver script'
             self.message = '[Errno %d] %s' % (errno, message)
         return self.message
index 8a3072ea09f39735cd28a504e9b28d99823658b8..5a4c38f049faf099d0cfd625e5920434c4545fe3 100644 (file)
@@ -57,6 +57,19 @@ isfile = os.path.isfile
 normpath = os.path.normpath
 
 
+def _patch_test_driver() -> None:
+    '''Patch the test-driver script in testdirs.'''
+    test_driver = joinpath('build-aux', 'test-driver')
+    diff = joinpath(DIRS['root'], joinpath('build-aux', 'test-driver.diff'))
+    command = f'patch {test_driver} < {diff}'
+    try:
+        result = sp.call(command, shell=True)
+        if result != 0:
+            raise GLError(20, None)
+    except OSError:
+        raise GLError(20, None)
+
+
 #===============================================================================
 # Define GLTestDir class
 #===============================================================================
@@ -841,6 +854,10 @@ class GLTestDir(object):
                     'LIBTOOLIZE=%s' % UTILS['libtoolize'],
                     'distclean']
             sp.call(args)
+        os.chdir(self.testdir)
+        if isfile(joinpath('build-aux', 'test-driver')):
+            _patch_test_driver()
+        os.chdir(DIRS['cwd'])
         sp.call(['rm', '-rf', self.config['tempdir']], shell=False)
 
 
@@ -999,5 +1016,7 @@ class GLMegaTestDir(object):
         args = [UTILS['automake'], '--add-missing', '--copy']
         constants.execute(args, verbose)
         shutil.rmtree('autom4te.cache')
+        if isfile(joinpath('build-aux', 'test-driver')):
+            _patch_test_driver()
         os.chdir(DIRS['cwd'])
         sp.call(['rm', '-rf', self.config['tempdir']], shell=False)
index a76de2ffe0a95c8a1d499158193a0e5c6b307094..58d4cd268e9e6ea599dc6c918f83828c7c3565cc 100644 (file)
@@ -1272,6 +1272,8 @@ if __name__ == '__main__':
                 message += 'module %s lacks a license' % errinfo
             elif errno == 19:
                 message += 'could not create destination directory: %s' % errinfo
+            elif errno == 20:
+                message += 'could not patch test-driver script'
             message += '\n%s: *** Stop.\n' % constants.APP['name']
             sys.stderr.write(message)
             sys.exit(1)