Skip to content

Commit afad3d5

Browse files
authored
Fix distutils.version.Version deprecation warning (#727)
This warning happens since Python 3.10, distutils.version.LooseVersion will now be replaced by libtmux._compat.LegacyVersion. This removes the warnings that were raised by distutils.
2 parents 4bffc35 + 850d890 commit afad3d5

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

CHANGES

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force
1717

1818
## tmuxp 1.19.x (unreleased)
1919

20+
<!-- Maintainers, insert changes / features for the next release here -->
21+
2022
### What's new
2123

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

4951
Credit: @zappolowski
5052

51-
<!-- Maintainers, insert changes / features for the next release here -->
53+
### Internal
54+
55+
- Update libtmux 0.15.9 -> 0.16.0
56+
57+
- Support for environmental variables
58+
- Remove reliance on `distutils.version.LooseVersion` for
59+
`libtmux._compat.LegacyVersion`
60+
- Fix distutil warnings by using libtmux 0.16.0's `LegacyVersion` (#727)
5261

5362
## tmuxp 1.18.2 (2022-11-06)
5463

setup.cfg

-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ line_length = 88
1818

1919
[tool:pytest]
2020
filterwarnings =
21-
ignore:distutils Version classes are deprecated. Use packaging.version instead.
2221
ignore:The frontend.Option(Parser)? class.*:DeprecationWarning::
23-
2422
addopts = --reruns=0 --tb=short --no-header --showlocals --doctest-modules
2523
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
2624
testpaths =

src/tmuxp/plugin.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from distutils.version import LooseVersion
2-
31
import libtmux
2+
from libtmux._compat import LegacyVersion as Version
43
from libtmux.common import get_version
54

65
from .__about__ import __version__
@@ -84,7 +83,7 @@ def __init__(
8483
# Dependency versions
8584
self.tmux_version = get_version()
8685
self.libtmux_version = libtmux.__version__
87-
self.tmuxp_version = LooseVersion(__version__)
86+
self.tmuxp_version = Version(__version__)
8887

8988
self.version_constraints = {
9089
"tmux": {
@@ -135,9 +134,9 @@ def _pass_version_check(self, version, vmin, vmax, incompatible):
135134
"""
136135
Provide affirmative if version compatibility is correct.
137136
"""
138-
if vmin and version < LooseVersion(vmin):
137+
if vmin and version < Version(vmin):
139138
return False
140-
if vmax and version > LooseVersion(vmax):
139+
if vmax and version > Version(vmax):
141140
return False
142141
if version in incompatible:
143142
return False

0 commit comments

Comments
 (0)