You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
distutils.sysconfig.parse_makefile() regression in Python 3.10 #88517
The regression is caused by the fact that the old implementation of parse_makefile in distutils.sysconfig was using feature-rich class TextFile which handles all the functionalities you reported as broken - stripping of comments, joining lines, and more.
The new implementation of parse_makefile in sysconfig just reads all the lines without any processing.
The TextFile class is deprecated together with the whole distutils. The class is not used outside of distutils modules, only in these functions:
distutils.extension:read_setup_file
distutils.sdist:read_template
+ its tests in distutils/tests/test_text_file.py
If the functionality is something we want to preserve, we should find a new home for the class and then we can use it in the sysconfig module.
IMO, the functionality should only be preserved until distutils is removed. So:
distutils.sysconfig.parse_makefile should use TextFile as before, so projects that use it aren't broken *yet*
nothing else should call distutils.sysconfig.parse_makefile, so it doesn't block removing distutils
Would that make sense?
hroncok commented on Jun 9, 2021
hroncokmannequin
MannequinAuthor
More actions
Yes, for the purposes of this bug, bringing TextFile-powered parse_makefile() back to distutils (and distutils only) is the right thing to do.
Whether or not Python needs a public standard library function to parse makefiles and whether that function in sysconfig is imperfect and needs improvements, that is an entirely different discussion.
Activity
hroncok commentedon Jun 8, 2021
Hello. I think #23142 changed the behavior of distutils.sysconfig.parse_makefile().
A downstream Fedora report with an affected petsc package: https://bugzilla.redhat.com/show_bug.cgi?id=1959088
Reproducers (DeprecationWarnings removed for readability):
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
And:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
And:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
frenzymadness commentedon Jun 9, 2021
Thanks for the report.
The regression is caused by the fact that the old implementation of parse_makefile in distutils.sysconfig was using feature-rich class TextFile which handles all the functionalities you reported as broken - stripping of comments, joining lines, and more.
The new implementation of parse_makefile in sysconfig just reads all the lines without any processing.
The TextFile class is deprecated together with the whole distutils. The class is not used outside of distutils modules, only in these functions:
distutils.extension:read_setup_file
distutils.sdist:read_template
+ its tests in distutils/tests/test_text_file.py
If the functionality is something we want to preserve, we should find a new home for the class and then we can use it in the sysconfig module.
encukou commentedon Jun 9, 2021
IMO, the functionality should only be preserved until distutils is removed. So:
Would that make sense?
hroncok commentedon Jun 9, 2021
Yes, for the purposes of this bug, bringing TextFile-powered parse_makefile() back to distutils (and distutils only) is the right thing to do.
Whether or not Python needs a public standard library function to parse makefiles and whether that function in sysconfig is imperfect and needs improvements, that is an entirely different discussion.
encukou commentedon Jun 11, 2021
New changeset fc98266 by Lumír 'Frenzy' Balhar in branch 'main':
bpo-44351: Restore back parse_makefile in distutils.sysconfig (GH-26637)
fc98266
encukou commentedon Jun 15, 2021
New changeset 2f2ea96 by Miss Islington (bot) in branch '3.10':
bpo-44351: Restore back parse_makefile in distutils.sysconfig (GH-26637) (GH-26673)
2f2ea96