Skip to content

Commit 8d433b2

Browse files
authored
Vendorize Version (#461)
In the future this will be replaced by our own, typed version comparator.
2 parents 3a9dff8 + 55f85f4 commit 8d433b2

File tree

5 files changed

+635
-1
lines changed

5 files changed

+635
-1
lines changed

CHANGES

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ $ pip install --user --upgrade --pre libtmux
1818

1919
- Remove unused `sphinx-click` development dependency
2020

21+
## libtmux 0.16.1 (2022-12-12)
22+
23+
### Fixes
24+
25+
- Remove reliance on `packaging.version.Version` (#461)
26+
27+
This is too critical of a package to pin a dependency as it may interfere with other packages the user relies on. In addition, libtmux doesn't need strict compatibility with `packaging`.
28+
2129
## libtmux 0.16.0 (2022-12-10)
2230

2331
### Breaking changes

src/libtmux/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def str_from_console(s: t.Union[str, bytes]) -> str:
3737
import re
3838
from typing import Iterator, List, Tuple
3939

40-
from packaging.version import Version
40+
from libtmux._vendor.version import Version
4141

4242
###
4343
### Legacy support for LooseVersion / LegacyVersion, e.g. 2.4-openbsd

src/libtmux/_vendor/__init__.py

Whitespace-only changes.

src/libtmux/_vendor/_structures.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# via https://github.com/pypa/packaging/blob/22.0/packaging/_structures.py
2+
# This file is dual licensed under the terms of the Apache License, Version
3+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
4+
# for complete details.
5+
6+
7+
class InfinityType:
8+
def __repr__(self) -> str:
9+
return "Infinity"
10+
11+
def __hash__(self) -> int:
12+
return hash(repr(self))
13+
14+
def __lt__(self, other: object) -> bool:
15+
return False
16+
17+
def __le__(self, other: object) -> bool:
18+
return False
19+
20+
def __eq__(self, other: object) -> bool:
21+
return isinstance(other, self.__class__)
22+
23+
def __gt__(self, other: object) -> bool:
24+
return True
25+
26+
def __ge__(self, other: object) -> bool:
27+
return True
28+
29+
def __neg__(self: object) -> "NegativeInfinityType":
30+
return NegativeInfinity
31+
32+
33+
Infinity = InfinityType()
34+
35+
36+
class NegativeInfinityType:
37+
def __repr__(self) -> str:
38+
return "-Infinity"
39+
40+
def __hash__(self) -> int:
41+
return hash(repr(self))
42+
43+
def __lt__(self, other: object) -> bool:
44+
return True
45+
46+
def __le__(self, other: object) -> bool:
47+
return True
48+
49+
def __eq__(self, other: object) -> bool:
50+
return isinstance(other, self.__class__)
51+
52+
def __gt__(self, other: object) -> bool:
53+
return False
54+
55+
def __ge__(self, other: object) -> bool:
56+
return False
57+
58+
def __neg__(self: object) -> InfinityType:
59+
return Infinity
60+
61+
62+
NegativeInfinity = NegativeInfinityType()

0 commit comments

Comments
 (0)