Re: gobject-introspection 1.86.0-1
Jon Turney via Cygwin <[email protected]> Sat, 4 Apr 2026 13:06:55 +0100
| Newsgroups | gmane.os.cygwin |
|---|---|
| Message-ID | <[email protected]> |
On 20/03/2026 05:38, Takashi Yano via Cygwin wrote:
>>>> Hi Takashi,
>>>>
>>>> I just tripped over a small problem with gobject-introspection:
>>>>
>>>>> $ /usr/sbin/alternatives --set python3 /usr/bin/python3.12
>>>>>
>>>>> $ g-ir-scanner
>>>>> Traceback (most recent call last):
>>>>> File "/usr/bin/g-ir-scanner", line 133, in <module>
>>>>> from giscanner.scannermain import scanner_main
>>>>> File "/usr/lib/gobject-introspection/giscanner/scannermain.py", line 35, in <module>
>>>>> from giscanner.ast import Include, Namespace
>>>>> File "/usr/lib/gobject-introspection/giscanner/ast.py", line 27, in <module>
>>>>> from .sourcescanner import CTYPE_TYPEDEF, CSYMBOL_TYPE_TYPEDEF
>>>>> File "/usr/lib/gobject-introspection/giscanner/sourcescanner.py", line 31, in <module>
>>>>> from giscanner._giscanner import SourceScanner as CSourceScanner
>>>>> ModuleNotFoundError: No module named 'giscanner._giscanner'
>>>>
>>>> This fails because the _giscanner module is built for (and linked
>>>> against) python3.9.
>>>
>>> Thanks for pointing this out.
>>> Currently, _giscanner is compiled as
>>> /usr/lib/gobject-introspection/giscanner/_giscanner.cpython-39-x86_64-cygwin.dll
>>> which perhaps requires libpython3.9.dll.
>>>
>>>> I don't quite understand why this is happening since we configure with
>>>> "-Dpython=${PYTHON3}", so I'd expect end up with the full path to
>>>> specific python version in the shebang line in g-ir-scanner.
>>>>
>>>> (I think that's what was happening before upstream switched from
>>>> autotools to meson)
>>>>
>>>> In any case, this can be fixed in the cygport by using
>>>> python3_fix_shebang on this script.
>>>
>>> Could you please let me know bit more detail how to use
>>> 'python3_fix_shebang'?
>>
>> Sure.
>>
>> In this case, I'd suggest adding a custom src_install which contains the
>> default for the meson cygclass [1], then uses python3_fix_shebang[2].
>>
>>> src_install() {
>>> cd ${S}
>>> meson_install
>>>
>>> python3_fix_shebang /usr/bin/g-ir-scanner
>>> }
>>
>> The idea is that this adjusts the shebang line in the installed
>> g-ir-scanner so it references python3.9, so that the import can be found
>> (and thus it can be invoked successfully), irrespective of what version
>> /usr/bin/python3 points to.
>>
>> Unfortunately, when I actually try it, it seems that it can't handle
>> '#!/usr/bin/env python3' and just rewrites the env part. How
>> disappointing! That seems like a cygport bug :(
Yeah, now I look at it, it seems that a shebang starting with env is not
handled by __fix_shebang.
I guess I should fix that!
>> I guess you could just use something like this instead:
>>
>>> sed -i -e "s#python3#${PYTHON3}#" ${D}/usr/bin/g-ir-scanner
>
> Thanks! I released 1.86.0-2 using:
> sed -i -e "s@python3@${PYTHON3##*/}@" ${D}/usr/bin/g-ir-annotation-tool
> sed -i -e "s@python3@${PYTHON3##*/}@" ${D}/usr/bin/g-ir-doc-tool
> sed -i -e "s@python3@${PYTHON3##*/}@" ${D}/usr/bin/g-ir-scanner
Thanks! That works fine now!
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple