bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool.py: Locate configure.ac correctly when --dir is given.


From: Collin Funk
Subject: gnulib-tool.py: Locate configure.ac correctly when --dir is given.
Date: Sat, 6 Apr 2024 05:12:25 -0700
User-agent: Mozilla Thunderbird

When running ./autogen.sh in gettext gnulib-tool.py fails on the first
invocation. :(

The command is something like this:

    $GNULIB_TOOL --dir=gettext-runtime ...

We get the following error message:

Traceback (most recent call last):
  File "/home/collin/.local/src/gnulib/.gnulib-tool.py", line 30, in <module>
    main.main_with_exception_handling()
  File "/home/collin/.local/src/gnulib/pygnulib/main.py", line 1382, in 
main_with_exception_handling
    main()
  File "/home/collin/.local/src/gnulib/pygnulib/main.py", line 953, in main
    importer = GLImport(config, mode)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/collin/.local/src/gnulib/pygnulib/GLImport.py", line 94, in 
__init__
    with codecs.open(self.config.getAutoconfFile(), 'rb', 'UTF-8') as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen codecs>", line 918, in open
FileNotFoundError: [Errno 2] No such file or directory: 
'gettext-runtime/gettext-runtime/configure.ac'

When moving the configure.{ac,in} checks to main I only had tests
with an implicit --dir='.'. This behavior is not visible in that case.

In main we have joinpath(destdir, 'configure.ac') which is then passed
to GLConfig.setAutoconfFile which has
os.path.join(self.table['destdir'], configure_ac).

The the implicit --dir='.' case:

    configure_ac = joinpath('.', 'configure.ac')
    # configure_ac == 'configure.ac'
    configure_ac = os.path.join('.', configure_ac)
    # configure_ac == './configure.ac'
    # Wrong process, correct answer.

in the --dir='gettext-runtime' case:

    configure_ac = joinpath('gettext-runtime', 'configure.ac')
    # configure_ac == 'gettext-runtime/configure.ac'
    os.path.join('gettext-runtime', configure_ac)
    # configure_ac == 'gettext-runtime/gettext-runtime/configure.ac'
    # Wrong process, wrong answer.

Since GLConfig.setAutoconfFile() is only used in main we can just have
it accept the argument as it is given. This patch fixes that.

The joinpath() and os.path.join() distinction is important for the
test suite. 'configure.ac' vs './configure.ac' will cause some test
failures. I've left a comment so it doesn't get changed.

Collin

Attachment: 0001-gnulib-tool.py-Locate-configure.ac-correctly-when-di.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]