Skip to content

Conversation

@kartben
Copy link
Contributor

@kartben kartben commented Oct 23, 2025

A follow-up to b96a5ad where we stopped having CI run tests on Python 2.x. This actually drops the few remaining Python 2.x compatibility bits as Python 2.x has EOL'd a long time ago.

@kartben kartben marked this pull request as ready for review October 23, 2025 16:11
Copy link
Collaborator

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of more places needs to be updated as well:

Kconfiglib/README.rst

Lines 124 to 126 in 1e6f644

Starting with Kconfiglib version 12.2.0, all utilities are compatible with both
Python 2 and Python 3. Previously, ``menuconfig.py`` only ran under Python 3
(i.e., it's now more backwards compatible than before).

implementation in Python 2/3. It started out as a helper library, but now has a

Kconfiglib/README.rst

Lines 167 to 174 in 1e6f644

Python version compatibility (2.7/3.2+)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kconfiglib and all utilities run under both Python 2.7 and Python 3.2 and
later. The code mostly uses basic Python features and has no third-party
dependencies, so keeping it backwards-compatible is pretty low effort.
The 3.2 requirement comes from ``argparse``. ``format()`` with unnumbered

Please check for more locations, those were just the ones I found on a quick search.

@kartben
Copy link
Contributor Author

kartben commented Oct 23, 2025

A couple of more places needs to be updated as well:

Kconfiglib/README.rst

Lines 124 to 126 in 1e6f644

Starting with Kconfiglib version 12.2.0, all utilities are compatible with both
Python 2 and Python 3. Previously, ``menuconfig.py`` only ran under Python 3
(i.e., it's now more backwards compatible than before).

implementation in Python 2/3. It started out as a helper library, but now has a

Kconfiglib/README.rst

Lines 167 to 174 in 1e6f644

Python version compatibility (2.7/3.2+)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kconfiglib and all utilities run under both Python 2.7 and Python 3.2 and
later. The code mostly uses basic Python features and has no third-party
dependencies, so keeping it backwards-compatible is pretty low effort.
The 3.2 requirement comes from ``argparse``. ``format()`` with unnumbered

Please check for more locations, those were just the ones I found on a quick search.

ouch, yes, "a couple" more indeed :) will actually move to draft as I suspect it might take me a few attempts to get everything right

@kartben kartben marked this pull request as draft October 23, 2025 20:02
A follow-up to b96a5ad where we stopped
having CI run tests on Python 2.x. This actually drops the few remaining
Python 2.x compatibility bits as Python 2.x has EOL'd a long time ago.

Signed-off-by: Benjamin Cabé <[email protected]>
@kartben kartben marked this pull request as ready for review October 26, 2025 06:42
@kartben
Copy link
Contributor Author

kartben commented Oct 26, 2025

@tejlmand - it should be better now! It was definitely more than "a couple" :)

@kartben kartben requested a review from tejlmand October 28, 2025 09:01
Copy link
Collaborator

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Only some minor nits.

Have this PR been verified on Windows ?

Comment on lines +168 to +169
Kconfiglib and all utilities run under Python 3.9 and later. The code mostly
uses basic Python features and has no third-party dependencies.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we mention that it might work on older Python versions, but this is not tested / guaranteed to work ?

Comment on lines -6915 to -6917
# On Python 3 versions before 3.6, it's not possible to specify the
# encoding when passing universal_newlines=True to Popen() (the 'encoding'
# parameter was added in 3.6), so we do this manual version instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping this comment make sense as it describes the reason for this construct.

Alternative, re-write the subprocess.run(...) to include universal_newlines=True and simplify this construct.

Side-note: seems the use of run() also means Python >=3.5 is now required 😉

stderr = stderr.decode(kconf._encoding)
except UnicodeDecodeError as e:
_decoding_error(e, kconf.filename, kconf.linenr)
result = subprocess.run(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding universal_newlines=True ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants