pywayland icon indicating copy to clipboard operation
pywayland copied to clipboard

pywayland-scanner throws KeyError 'wl_surface'

Open heuer opened this issue 10 months ago • 2 comments

I fixed the import error from issue #57 locally, but now I get another error:

pywayland-scanner -i wlr-layer-shell-unstable-v1.xml
Traceback (most recent call last):
  File "/home/user/pywayland-test/bin/pywayland-scanner", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/pywayland-test/lib/python3.11/site-packages/pywayland/scanner/__main__.py", line 117, in main
    protocol.output(args.output_dir, protocol_imports)
  File "/home/user/pywayland-test/lib/python3.11/site-packages/pywayland/scanner/protocol.py", line 109, in output
    iface.output(printer, module_imports)
  File "/home/user/pywayland-test/lib/python3.11/site-packages/pywayland/scanner/interface.py", line 67, in output
    imports = set(
              ^^^^
  File "/home/user/pywayland-test/lib/python3.11/site-packages/pywayland/scanner/interface.py", line 70, in <genexpr>
    for _import in method.imports(self.name, module_imports)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/pywayland-test/lib/python3.11/site-packages/pywayland/scanner/method.py", line 64, in imports
    import_protocol = module_imports[arg.interface]
                      ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'wl_surface'

heuer avatar Mar 24 '24 20:03 heuer

I think I got it. I have to provide the "context" protocols as well

pywayland-scanner -i /usr/share/wayland/wayland.xml /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml wlr-layer-shell-unstable-v1.xml -o protocols

heuer avatar Mar 25 '24 12:03 heuer

But now the imports in the generated files are not quite correct because the imports are now relative to each other and i.e. pywayland.protocol.wayland is not used.

I suspect that this would be the correct way:

pywayland-scanner --with-protocols -i wlr-layer-shell-unstable-v1.xml -o protocol

But then I get the above KeyError again.

pkg-config is available on my system:

xbps-query -l | grep pkg-config
ii pkg-config-0.29.2_3                           System for managing library compile/link flags

Any idea what I'm still doing wrong?

heuer avatar Mar 25 '24 13:03 heuer