Skip to content

Commit

Permalink
fix deprecated warning (#169)
Browse files Browse the repository at this point in the history
see #168
  • Loading branch information
typemytype authored Sep 7, 2022
1 parent 1887737 commit 9b96eef
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Lib/vanilla/vanillaBase.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import platform
from distutils.version import StrictVersion
from packaging.version import Version
from Foundation import NSObject
from AppKit import NSFont, NSRegularControlSize, NSSmallControlSize, NSMiniControlSize, \
NSViewMinXMargin, NSViewMaxXMargin, NSViewMaxYMargin, NSViewMinYMargin, \
Expand Down Expand Up @@ -29,19 +29,19 @@ class VanillaWarning(Warning): pass
macVersion = platform.mac_ver()[0]
if platform.system() != "Darwin":
macVersion = "0.0"
osVersionCurrent = StrictVersion(macVersion)
osVersion12_0 = StrictVersion("12.0")
osVersion10_16 = StrictVersion("10.16") # macOS11 Big Sur seems to be 10.16
osVersion10_15 = StrictVersion("10.15")
osVersion10_14 = StrictVersion("10.14")
osVersion10_13 = StrictVersion("10.13")
osVersion10_12 = StrictVersion("10.12")
osVersion10_11 = StrictVersion("10.11")
osVersion10_10 = StrictVersion("10.10")
osVersion10_9 = StrictVersion("10.9")
osVersion10_8 = StrictVersion("10.8")
osVersion10_7 = StrictVersion("10.7")
osVersion10_6 = StrictVersion("10.6")
osVersionCurrent = Version(macVersion)
osVersion12_0 = Version("12.0")
osVersion10_16 = Version("10.16") # macOS11 Big Sur seems to be 10.16
osVersion10_15 = Version("10.15")
osVersion10_14 = Version("10.14")
osVersion10_13 = Version("10.13")
osVersion10_12 = Version("10.12")
osVersion10_11 = Version("10.11")
osVersion10_10 = Version("10.10")
osVersion10_9 = Version("10.9")
osVersion10_8 = Version("10.8")
osVersion10_7 = Version("10.7")
osVersion10_6 = Version("10.6")


# ---------
Expand Down

3 comments on commit 9b96eef

@schriftgestalt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit add an external dependency (packaging has to be manually installed with pip) that breaks all plugins and script in Glyphs.app.

@justvanrossum
Copy link
Collaborator

@justvanrossum justvanrossum commented on 9b96eef Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just use something simple like this, instead of packaging.Version:

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

@schriftgestalt
Copy link
Contributor

@schriftgestalt schriftgestalt commented on 9b96eef Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a few things and it seem that the padding to three parts is not needed. At least for less or greater than comparisons.

Please sign in to comment.