bitrot icon indicating copy to clipboard operation
bitrot copied to clipboard

Build failure with waf on Python 3.11

Open NexAdn opened this issue 2 years ago • 1 comments

Related issue in audio-overlay: https://github.com/gentoo-audio/audio-overlay/issues/531

During package testing for the Gentoo audio overlay I've experienced a build failure when using Python 3.11 to run waf:

'PYTHONHASHSEED=1' 'CCFLAGS=-march=native -O2 -pipe -Wodr -frecord-gcc-switches' 'LINKFLAGS=-march=native -O2 -pipe -Wodr -frecord-gcc-switches -march=native -O2 -pipe -Wodr -Wl,-O1 -Wl,--defsym=__gentoo_check_ldflags__=0' 'PKGCONFIG=x86_64-pc-linux-gnu-pkg-config' '/var/tmp/portage/media-plugins/bitrot-9999/work/bitrot-9999/waf' '--jobs=1' '--prefix=/usr' 'configure'
Waf: The wscript in '/var/tmp/portage/media-plugins/bitrot-9999/work/bitrot-9999' is unreadable
Traceback (most recent call last):
  File "/var/tmp/portage/media-plugins/bitrot-9999/work/bitrot-9999/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Scripting.py", line 102, in waf_entry_point
    set_main_module(wscript)
  File "/var/tmp/portage/media-plugins/bitrot-9999/work/bitrot-9999/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Scripting.py", line 142, in set_main_module
    Context.g_module=Context.load_module(file_path)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/media-plugins/bitrot-9999/work/bitrot-9999/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Context.py", line 349, in load_module
    code=Utils.readf(path,m='rU',encoding=encoding)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/media-plugins/bitrot-9999/work/bitrot-9999/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Utils.py", line 141, in readf
    with open(fname,m)as f:
         ^^^^^^^^^^^^^
ValueError: invalid mode: 'rUb'

I get the same issue when running waf outside of the packaging environment:

[nex@laptop bitrot]$ python3.11 waf configure
Waf: The wscript in '/home/nex/projects/bitrot' is unreadable
Traceback (most recent call last):
  File "/home/nex/projects/bitrot/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Scripting.py", line 102, in waf_entry_point
    set_main_module(wscript)
  File "/home/nex/projects/bitrot/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Scripting.py", line 142, in set_main_module
    Context.g_module=Context.load_module(file_path)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nex/projects/bitrot/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Context.py", line 349, in load_module
    code=Utils.readf(path,m='rU',encoding=encoding)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nex/projects/bitrot/.waf3-2.0.12-6cd57ca9068ebdd4dc6caef5723653c7/waflib/Utils.py", line 141, in readf
    with open(fname,m)as f:
         ^^^^^^^^^^^^^
ValueError: invalid mode: 'rUb'

I assume this might require either a waf update or adjustments in the wscript.

NexAdn avatar May 07 '23 11:05 NexAdn

Probably needs a waf update since Python 3.11 dropped the U mode. Feel free to open a PR!

grejppi avatar May 08 '23 19:05 grejppi