Bug 2275048

Summary: waf fails to build with Python 3.13: AttributeError: 'Values' object has no attribute 'jobs'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: wafAssignee: Thomas Moschny <thomas.moschny>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: asn, ksurma, mhroncok, michel, thomas.moschny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-09-27 13:08:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2244836, 2275044, 2275045    

Description Karolina Surma 2024-04-15 06:54:27 UTC
waf fails to build with Python 3.13.0a6.

+ /usr/bin/python3 ./waf-light --make-waf --strip --tools=batched_cc,biber,bjam,blender,boo,boost,build_file_tracker,build_logs,buildcopy,c_bgxlc,c_dumbpreproc,c_emscripten,c_nec,cabal,cfg_altoptions,clang_compilation_database,clang_cross,clang_cross_common,clangxx_cross,classic_runner,codelite,color_gcc,color_msvc,color_rvct,compat15,cppcheck,cpplint,cross_gnu,cython,dcc,distnet,doxygen,dpapi,eclipse,erlang,fast_partial,fc_bgxlf,fc_cray,fc_fujitsu,fc_nag,fc_nec,fc_nfort,fc_open64,fc_pgfortran,fc_solstudio,fc_xlf,file_to_object,fluid,freeimage,fsb,fsc,gccdeps,gdbus,genpybind,gob2,halide,haxe,javatest,kde4,local_rpath,make,midl,msvc_pdb,msvcdeps,msvs,netcache_client,objcopy,ocaml,package,parallel_debug,pch,pep8,pgicc,pgicxx,proc,protoc,pyqt5,pytest,qnxnto,qt4,relocation,remote,resx,review,rst,run_do_script,run_m_script,run_py_script,run_r_script,sas,satellite_assembly,scala,slow_qt4,softlink_libs,sphinx,stale,stracedeps,swig,syms,ticgt,unity,use_config,valadoc,waf_xattr,wafcache,why,win32_opts,wix,xcode6
------> Executing code from the top-level wscript <-----
Traceback (most recent call last):
  File "/builddir/build/BUILD/waf-2.0.27/waflib/Scripting.py", line 159, in waf_entry_point
    run_commands()
    ~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/waf-2.0.27/waflib/Scripting.py", line 251, in run_commands
    parse_options()
    ~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/waf-2.0.27/waflib/Scripting.py", line 217, in parse_options
    ctx.execute()
    ~~~~~~~~~~~^^
  File "/builddir/build/BUILD/waf-2.0.27/waflib/Options.py", line 358, in execute
    Utils.alloc_process_pool(options.jobs)
                             ^^^^^^^^^^^^
AttributeError: 'Values' object has no attribute 'jobs'

https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07303022-waf/

For all our attempts to build waf with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/waf/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Andreas Schneider 2024-04-15 10:17:22 UTC
The code actually is like this:


import optparse
options = optparse.Values()
...
Utils.alloc_process_pool(options.jobs)



It looks like options.jobs doesn't exist anymore. From https://docs.python.org/3.13/whatsnew/3.13.html:

getopt and optparse modules: They are now soft deprecated: the argparse module should be used for new projects. Previously, the optparse module was already deprecated, its removal was not scheduled, and no warnings was emitted: so there is no change in practice. (Contributed by Victor Stinner in gh-106535.)


It looks like this deprecation isn't so soft.

Comment 2 Thomas Moschny 2024-04-15 11:38:24 UTC
Hm. This snippet:

from optparse import OptionParser
parser = OptionParser()
parser.add_option('-j', '--jobs', type='int', dest="jobs")
(options, args) = parser.parse_args(args=['-j8'])
print(options.jobs)

works for both, 3.12 and 3.13 in my tests.

The culprit must at a not so obvious location...

Comment 3 Thomas Moschny 2024-04-15 22:04:49 UTC
The problem is there in a06, but not in a05. After testing and searching around, I am pretty confident this is https://github.com/python/cpython/issues/117750.

Comment 4 Karolina Surma 2024-04-16 09:59:41 UTC
I backported https://github.com/python/cpython/pull/117808 to our copr Python and rebuilt waf - it's built successfully: https://copr.fedorainfracloud.org/coprs/g/python/python3.13/build/7316612/

Comment 5 Thomas Moschny 2024-04-16 11:54:20 UTC
Cool. So, we leave the bug open for now, but close whenever an 'official' 3.13 build hits rawhide?

Comment 6 Karolina Surma 2024-09-27 13:08:53 UTC
waf keeps building with the "almost official" 3.13, so closing.