From 685a8726bdbc00bb6f1f8aca95ad53f2960e7d2e Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sat, 6 Apr 2024 04:41:03 -0700 Subject: [PATCH] gnulib-tool.py: Locate configure.ac correctly when --dir is given. * pygnulib/GLConfig.py (GLConfig.setAutoconfFile): Don't combine the given file name argument with destdir. * pygnulib/main.py (main): Use os.path.join() instead of joinpath() when constructing the path to the configure.ac file. The latter normalizes paths which causes the test suite to fail when printed in files. --- ChangeLog | 9 +++++++++ pygnulib/GLConfig.py | 3 +-- pygnulib/main.py | 12 +++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d069b83e2..7e90c5bad1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-04-07 Collin Funk + + gnulib-tool.py: Locate configure.ac correctly when --dir is given. + * pygnulib/GLConfig.py (GLConfig.setAutoconfFile): Don't combine the + given file name argument with destdir. + * pygnulib/main.py (main): Use os.path.join() instead of joinpath() when + constructing the path to the configure.ac file. The latter normalizes + paths which causes the test suite to fail when printed in files. + 2024-04-06 Bruno Haible expm1l: Work around a NetBSD 10.0/i386 bug. diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py index 1c9caa218b..f5282dbf53 100644 --- a/pygnulib/GLConfig.py +++ b/pygnulib/GLConfig.py @@ -1025,8 +1025,7 @@ class GLConfig: '''Specify path of autoconf file relative to destdir.''' if type(configure_ac) is str: if configure_ac: - self.table['configure_ac'] = \ - os.path.join(self.table['destdir'], configure_ac) + self.table['configure_ac'] = configure_ac else: # if type of configure_ac is not str raise TypeError('configure_ac must be a string, not %s' % type(configure_ac).__name__) diff --git a/pygnulib/main.py b/pygnulib/main.py index 4bf4da4279..a67252f7f6 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -910,12 +910,14 @@ def main() -> None: config.setDestDir(destdir) # Prefer configure.ac but also look for configure.in. - if isfile(joinpath(destdir, 'configure.ac')): - configure_ac = joinpath(destdir, 'configure.ac') - elif isfile(joinpath(destdir, 'configure.in')): - configure_ac = joinpath(destdir, 'configure.in') + # NOTE: Use os.path.join so the leading './' is not removed. This + # is to make the gnulib-tool test suite happy. + if isfile(os.path.join(destdir, 'configure.ac')): + configure_ac = os.path.join(destdir, 'configure.ac') + elif isfile(os.path.join(destdir, 'configure.in')): + configure_ac = os.path.join(destdir, 'configure.in') else: - raise GLError(3, joinpath(destdir, 'configure.ac')) + raise GLError(3, os.path.join(destdir, 'configure.ac')) # Save the Autoconf file path for the rest of the import. config.setAutoconfFile(configure_ac) -- 2.39.5