From: Collin Funk Date: Sat, 9 Mar 2024 04:59:16 +0000 (-0800) Subject: gnulib-tool.py: Follow gnulib-tool changes, part 48. X-Git-Tag: v1.0~314 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=49c7d53c8581df6ced502baadf1b24b0fb4f130a;p=gnulib.git gnulib-tool.py: Follow gnulib-tool changes, part 48. Follow gnulib-tool change 2019-01-23 Bruno Haible 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. --- diff --git a/ChangeLog b/ChangeLog index 042fd868eb..10de1262c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2024-03-09 Collin Funk + + gnulib-tool.py: Follow gnulib-tool changes, part 48. + Follow gnulib-tool change + 2019-01-23 Bruno Haible + 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 gnulib-tool: Don't remove comments referencing @NMD@. diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO index 8918d58a88..7632991780 100644 --- a/gnulib-tool.py.TODO +++ b/gnulib-tool.py.TODO @@ -431,18 +431,6 @@ Date: Mon Nov 18 13:32:46 2019 +0100 -------------------------------------------------------------------------------- -commit 425ee42259b04956aae20afc5204775ae6e79744 -Author: Bruno Haible -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 Date: Fri Jan 4 19:34:19 2019 +0100 diff --git a/pygnulib/GLError.py b/pygnulib/GLError.py index 5c7420e8b1..0fd1fcf3a1 100644 --- a/pygnulib/GLError.py +++ b/pygnulib/GLError.py @@ -61,6 +61,7 @@ class GLError(Exception): 17: cannot update the given file: 18: module lacks a license: 19: could not create destination 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 diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index 8a3072ea09..5a4c38f049 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -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) diff --git a/pygnulib/main.py b/pygnulib/main.py index a76de2ffe0..58d4cd268e 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -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)