Skip to content

Commit 873d983

Browse files
remove deprecated code without extra dependency (#170)
* Revert "fix deprecated warning (#169)" This reverts commit 9b96eef. * remove deprecated function see 9b96eef
1 parent 9b96eef commit 873d983

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

Lib/vanilla/vanillaBase.py

+21-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import platform
2-
from packaging.version import Version
2+
33
from Foundation import NSObject
44
from AppKit import NSFont, NSRegularControlSize, NSSmallControlSize, NSMiniControlSize, \
55
NSViewMinXMargin, NSViewMaxXMargin, NSViewMaxYMargin, NSViewMinYMargin, \
@@ -17,6 +17,13 @@
1717

1818
from vanilla.nsSubclasses import getNSSubclass
1919

20+
def version(versionString):
21+
parts = [int(p) for p in versionString.split(".")]
22+
if len(parts) > 3:
23+
raise TypeError(f"version string has more than three parts: {versionString}")
24+
while len(parts) < 3:
25+
parts.append(0)
26+
return tuple(parts)
2027

2128
class VanillaError(Exception): pass
2229

@@ -29,19 +36,19 @@ class VanillaWarning(Warning): pass
2936
macVersion = platform.mac_ver()[0]
3037
if platform.system() != "Darwin":
3138
macVersion = "0.0"
32-
osVersionCurrent = Version(macVersion)
33-
osVersion12_0 = Version("12.0")
34-
osVersion10_16 = Version("10.16") # macOS11 Big Sur seems to be 10.16
35-
osVersion10_15 = Version("10.15")
36-
osVersion10_14 = Version("10.14")
37-
osVersion10_13 = Version("10.13")
38-
osVersion10_12 = Version("10.12")
39-
osVersion10_11 = Version("10.11")
40-
osVersion10_10 = Version("10.10")
41-
osVersion10_9 = Version("10.9")
42-
osVersion10_8 = Version("10.8")
43-
osVersion10_7 = Version("10.7")
44-
osVersion10_6 = Version("10.6")
39+
osVersionCurrent = version(macVersion)
40+
osVersion12_0 = version("12.0")
41+
osVersion10_16 = version("10.16") # macOS11 Big Sur seems to be 10.16
42+
osVersion10_15 = version("10.15")
43+
osVersion10_14 = version("10.14")
44+
osVersion10_13 = version("10.13")
45+
osVersion10_12 = version("10.12")
46+
osVersion10_11 = version("10.11")
47+
osVersion10_10 = version("10.10")
48+
osVersion10_9 = version("10.9")
49+
osVersion10_8 = version("10.8")
50+
osVersion10_7 = version("10.7")
51+
osVersion10_6 = version("10.6")
4552

4653

4754
# ---------

0 commit comments

Comments
 (0)