{{ message }}
Deprecate compat.is_<platform>, rewriting all uses#1732
Merged
Byron merged 2 commits intogitpython-developers:mainfrom Nov 6, 2023
Merged
Deprecate compat.is_<platform>, rewriting all uses#1732Byron merged 2 commits intogitpython-developers:mainfrom
Byron merged 2 commits intogitpython-developers:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #1731
Major changes:
is_winandis_posixingit/andtest/, replacing them withos.name == "nt"andos.name == "posix", respectively.is_darwinby changing it to usesys.platforminstead ofos.namewhich is never"darwin".git.compatmodule above the definitions ofis_win,is_posix, andis_darwinstating that they are deprecated and recommending thatos.name(or, where applicable,sys.platform) be used directly instead for clarity (and sometimes accuracy).There were no uses of
is_darwinto be replaced. Although it had been used at one time, the last reference to it appears to have been removed in 4545762 (#1295).This doesn't emit a
DeprecationWarningwhen those attributes are accessed from thegit.compatmodule. (That might be valuable thing to do in the future, if thegit.compatmodule is to remain non-deprecated overall. See discussion in #1731.)Two related less consequential changes are also included:
is_<platform>(usuallyis_win) fromgit.compat.is_<platform>.)