Skip to content

Commit

Permalink
Remove dependency from distutils.version (albertosottile#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertosottile committed Jul 13, 2022
1 parent 1b9a26f commit a34c8f1
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions darkdetect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@
import sys
import platform

if sys.platform == "darwin":
from distutils.version import LooseVersion as V
if V(platform.mac_ver()[0]) < V("10.14"):
from ._dummy import *
def macos_supported_version():
sysver = platform.mac_ver()[0] #typically 10.14.2 or 12.3
major = int(sysver.split('.')[0])
if major < 10:
return False
elif major >= 11:
return True
else:
minor = int(sysver.split('.')[1])
if minor < 14:
return False
else:
return True

if sys.platform == "darwin":
if macos_supported_version():
from ._mac_detect import *
del V
else:
from ._dummy import *
elif sys.platform == "win32" and platform.release().isdigit() and int(platform.release()) >= 10:
# Checks if running Windows 10 version 10.0.14393 (Anniversary Update) OR HIGHER. The getwindowsversion method returns a tuple.
# The third item is the build number that we can use to check if the user has a new enough version of Windows.
Expand Down

0 comments on commit a34c8f1

Please sign in to comment.