Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate compat.is_<platform>, rewriting all uses #1732

Merged
merged 2 commits into from
Nov 6, 2023

Commits on Nov 4, 2023

  1. Deprecate compat.is_<platform>, rewriting all uses

    Major changes:
    
    - Add a comment in the git.compat module above the definitions of
      is_win, is_posix, and is_darwin stating that they are deprecated
      and recommending that os.name (or, where applicable,
      sys.platform) be used directly instead for clarity (and sometimes
      accuracy).
    
    - Remove all uses of is_win and is_posix in git/ and test/,
      replacing them with `os.name == "nt"` and `os.name == "posix"`,
      respectively.
    
    There were no uses of is_darwin to be replaced. Although it had
    been used at one time, the last reference to it appears to have
    been removed in 4545762 (gitpython-developers#1295).
    
    This doesn't emit a DeprecationWarning when those attributes are
    accessed in the git.compat module. (That might be valuable thing to
    do in the future, if the git.compat module is to remain
    non-deprecated overall.)
    
    Two related less consequential changes are also included:
    
    - Improve ordering and grouping of imports, in modules where they
      were already being changed as a result of no longer needing to
      import is_<platform> (usually is_win) from git.compat.
    
    - Make minor revisions to a few comments, for readability. (This is
      in addition to somewhat more substantial revisions of comments
      where rewording was related to replacing uses of is_<platform>.)
    EliahKagan committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    c01fe76 View commit details
    Browse the repository at this point in the history
  2. Fix compat.is_darwin

    This fixes compat.is_darwin to use sys.platform instead of os.name
    so that it is True on macOS systems instead of always being False.
    The deprecation rationale in compat.py is accordingly adjusted.
    
    Together with c01fe76, this largely addresses gitpython-developers#1731.
    EliahKagan committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    562bdee View commit details
    Browse the repository at this point in the history