Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#55915 - [glib2] gdbus-codegen - No module named 'codegen'

Attached to Project: Arch Linux
Opened by Fabian Maurer (DarkShadow44) - Sunday, 08 October 2017, 12:17 GMT
Last edited by Jan de Groot (JGC) - Friday, 23 August 2019, 21:34 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Jan de Groot (JGC)
Jan Alexander Steffens (heftig)
Architecture x86_64
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No


The gdbus-codegen script included in glib2 doesn't work, it complains about a missing module.
This makes for example the package lib32-gst-plugins-bad from the AUR unable to compile.

Additional info:
* glib2 2.54.1-1

Steps to reproduce:
Running gdbus-codegen in the terminal yields

Traceback (most recent call last):
File "/bin/gdbus-codegen", line 41, in <module>
from codegen import codegen_main
ModuleNotFoundError: No module named 'codegen'
This task depends upon

Closed by  Jan de Groot (JGC)
Friday, 23 August 2019, 21:34 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fix is in a released version of glib2 now.
Comment by arc (arcnmx) - Wednesday, 11 October 2017, 16:58 GMT
Ran into this when building gtk3. Note that /usr/bin/gdbus-codegen does indeed work, so this bug only manifests depending on whether /bin or /usr/bin is first/present in $PATH. My current workaround is to export PYTHONPATH="/usr/share/glib-2.0" in the PKGBUILD.

gdbus-codegen computes a path based on $(dirname /bin/gdbus-codegen)/../share/glib-2.0 and flattens it with os.path.abspath, which doesn't follow symlinks. os.path.realpath may be more appropriate?
Comment by Doug Newgard (Scimmia) - Wednesday, 11 October 2017, 17:13 GMT
So this is only an issue if /bin is in $PATH. Sounds like "not a bug" to me.
Comment by arc (arcnmx) - Wednesday, 11 October 2017, 17:21 GMT
Whether or not it's an arch bug, the path logic is pretty silly and fragile. Seems like it's already been patched upstream though:
Comment by Davide Depau (depaulicious) - Sunday, 04 February 2018, 15:31 GMT
@arcnmx the fix above doesn't fix the issue if `gdbus-codegen` is placed in /usr/sbin. In my fresh Arch installation, for whatever reason, there's a symlink from /usr/sbin/gdbus-codegen to /usr/bin/gdbus-codegen. sbin takes precedence.
Fix (for this particular scenario) is trivial:

< elif os.path.basename(filedir) == 'bin':
> elif os.path.basename(filedir) in ('bin', 'sbin'):

I'm not sure whether this should be added upstream or in Arch.
Comment by Doug Newgard (Scimmia) - Sunday, 04 February 2018, 15:38 GMT
It can't be "placed in" /usr/sbin/, because /usr/sbin is a symlink to usr/bin. sbin only takes precedence if your $PATH is broken.
Comment by Eli Schwartz (eschwartz) - Monday, 05 February 2018, 15:40 GMT
Why doesn't it fix it -- it should be falling back on the non-relocatable, hardcoded datadir, which is kind of the point of the whole /bin fix...
Comment by Uwe Koloska (kolewu) - Monday, 12 March 2018, 13:31 GMT
Despite `gdbus-codegen` maybe fixed, the wrong (or not suited for archlinux) path may come from your display manager. At least lxdm sets the PATH to "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin" if not configured otherwise.
Comment by Eli Schwartz (eschwartz) - Monday, 12 March 2018, 16:32 GMT
No, the problem is that the fix has not been backported into our glib2 package, and upstream only fixed it in their unstable version...

Which is available in
I don't know about their release cycle but I guess being in the gnome-unstable repos means we might see this soon...