Skip to content

Fix distutils.version.Version deprecation warning (python 3.10) #727

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

Merged
merged 4 commits into from
Dec 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force

## tmuxp 1.19.x (unreleased)

<!-- Maintainers, insert changes / features for the next release here -->

### What's new

- Environment variables for windows / panes (#845)
Expand Down Expand Up @@ -48,7 +50,14 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force

Credit: @zappolowski

<!-- Maintainers, insert changes / features for the next release here -->
### Internal

- Update libtmux 0.15.9 -> 0.16.0

- Support for environmental variables
- Remove reliance on `distutils.version.LooseVersion` for
`libtmux._compat.LegacyVersion`
- Fix distutil warnings by using libtmux 0.16.0's `LegacyVersion` (#727)

## tmuxp 1.18.2 (2022-11-06)

Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ line_length = 88

[tool:pytest]
filterwarnings =
ignore:distutils Version classes are deprecated. Use packaging.version instead.
ignore:The frontend.Option(Parser)? class.*:DeprecationWarning::

addopts = --reruns=0 --tb=short --no-header --showlocals --doctest-modules
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
testpaths =
Expand Down
9 changes: 4 additions & 5 deletions src/tmuxp/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from distutils.version import LooseVersion

import libtmux
from libtmux._compat import LegacyVersion as Version
from libtmux.common import get_version

from .__about__ import __version__
Expand Down Expand Up @@ -84,7 +83,7 @@ def __init__(
# Dependency versions
self.tmux_version = get_version()
self.libtmux_version = libtmux.__version__
self.tmuxp_version = LooseVersion(__version__)
self.tmuxp_version = Version(__version__)

self.version_constraints = {
"tmux": {
Expand Down Expand Up @@ -135,9 +134,9 @@ def _pass_version_check(self, version, vmin, vmax, incompatible):
"""
Provide affirmative if version compatibility is correct.
"""
if vmin and version < LooseVersion(vmin):
if vmin and version < Version(vmin):
return False
if vmax and version > LooseVersion(vmax):
if vmax and version > Version(vmax):
return False
if version in incompatible:
return False
Expand Down