khmer 3.0.0 FTBFS against Python 3.12

Bug #2044383 reported by Olivier Gayot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
khmer (Debian)
Fix Released
Unknown
khmer (Ubuntu)
Fix Released
High
Olivier Gayot

Bug Description

khmer FTBFS against Python 3.12. See https://launchpadlibrarian.net/698370219/buildlog_ubuntu-noble-amd64.khmer_3.0.0~a3+dfsg-5build1_BUILDING.txt.gz

make[1]: Entering directory '/<<PKGBUILDDIR>>'
dh_auto_clean || /bin/true
 pybuild --clean -i python{version} -p "3.12 3.11"
I: pybuild base:310: python3.12 setup.py clean
/<<PKGBUILDDIR>>/versioneer.py:421: SyntaxWarning: invalid escape sequence '\s'
  LONG_VERSION_PY['git'] = '''
*** NOTE: Found Cython, extension files will be transpiled if this is an install invocation.
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/setup.py", line 200, in <module>
    "define_macros": [("VERSION", versioneer.get_version()), ],
                                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/versioneer.py", line 1480, in get_version
    return get_versions()["version"]
           ^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/versioneer.py", line 1412, in get_versions
    cfg = get_config_from_root(root)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/versioneer.py", line 342, in get_config_from_root
    parser = configparser.SafeConfigParser()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

Ever since Python 3.2, configparser.SafeConfigParser has been deprecated in
favor of configparser.ConfigParser. An alias existed for backward compatibility
but the alias was dropped from Python 3.12

The project upstream seems pretty dead (last change is 4 years old) but if we can make the package build against Python 3.12 with a simple change, I think that's worth our time.

Olivier Gayot (ogayot)
Changed in khmer (Ubuntu):
assignee: nobody → Olivier Gayot (ogayot)
description: updated
Revision history for this message
Olivier Gayot (ogayot) wrote :
Changed in khmer (Debian):
status: Unknown → New
Revision history for this message
Simon Quigley (tsimonq2) wrote :

Uploaded, thanks!

I really appreciate you forwarding this to Debian, uploading to your PPA to test, and using DEP-3 headers for the patch. Green flags all around.

Changed in khmer (Ubuntu):
status: New → Fix Committed
importance: Undecided → High
Revision history for this message
Olivier Gayot (ogayot) wrote (last edit ):

Thanks for the praise Simon!

And I apologize about the build failure mess. My PPA didn't build with -proposed enabled so I wrongly assumed that the build with Python 3.12 was green :/

Thanks for taking a look at the readfp/read_file thingy :)

I looked at the remaining test failures and made the needed changes.

TIL Python 3.12 is not as forgiving as previous Python versions when scripts forget to .close() resources that they open for writing (either explicitly or upon exiting a "with" block). With Python 3.12, the files appear truncated if they are not closed properly. This makes the test-suite fail or even hang on some of the test cases.

I went through all the scripts and hopefully addressed all the occurrences of files not properly closed. It took way too long and in hindsight, I should have filed a removal bug from the get go... I'll consider it a good learning experience!

Anyway, the build now succeeds and autopkgtests as well.

I witnessed the "test_abundance_dist_threaded" test fail once and I assume it's a concurrency issue in khmer. I did not reproduce the failure again so I don't think it's worth marking it flaky.

I sent the changes again to Debian and updated my upstream PR.

Revision history for this message
Simon Quigley (tsimonq2) wrote :

Sponsored again. Thanks!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package khmer - 3.0.0~a3+dfsg-5ubuntu3

---------------
khmer (3.0.0~a3+dfsg-5ubuntu3) noble; urgency=medium

  * Ensure that the scripts properly close files that they open for writing.
    Python 3.12 seems to be less forgiving and oftentimes, files end up
    truncated.
  * Ensure importlib is used instead of imp, which was dropped from Python
    3.12.

 -- Olivier Gayot <email address hidden> Sun, 26 Nov 2023 02:28:32 +0100

Changed in khmer (Ubuntu):
status: Fix Committed → Fix Released
Changed in khmer (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.