Re: gobject-introspection 1.86.0-1

Jon Turney via Cygwin <[email protected]>
Newsgroups gmane.os.cygwin
Message-ID <[email protected]>
On 17/03/2026 13:04, Takashi Yano via Cygwin wrote:
> Hi Jon,
> 
> Sorry for the late reply.

No problem! I understand that you have many other, more important 
demands on your time.

[...]
>> 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 :(

I guess you could just use something like this instead:

> sed -i -e "s#python3#${PYTHON3}#" ${D}/usr/bin/g-ir-scanner 

(But as I say, this all seems a bit like maybe an upstream bug that the 
python interpreter passed in via CYGMESON_ARGS doesn't end up there anyway?)


[1] 
https://cygwin.github.io/cygport/meson_cygclass.html#src_install%20(meson)
[2] 
https://cygwin.github.io/cygport/python3_cygclass.html#python3_fix_shebang


-- 
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.