Skip to content

Commit

Permalink
replace distutils for python 3.12
Browse files Browse the repository at this point in the history
Python 3.12 has removed distutils: https://docs.python.org/3.12/whatsnew/3.12.html#removed

Updated comments and minimum version to match Darwin kernel based on
@branchvincent's explanation at
#149 (comment)

Signed-off-by: Daniel Lenski <[email protected]>
  • Loading branch information
branchvincent authored and dlenski committed May 10, 2024
1 parent 8836aa6 commit 4e26adb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vpn_slice/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ def get_default_providers():
prep = CheckTunDevProvider,
)
elif platform.startswith('darwin'):
from distutils.version import LooseVersion
from platform import release

from .dnspython import DNSPythonProvider
from .mac import BSDRouteProvider, MacSplitDNSProvider, PfFirewallProvider, PsProvider
from .posix import PosixHostsFileProvider
parsed_release = tuple(int(d) if d.isdigit() else 0 for d in release().split("."))
return dict(
process=PsProvider,
route=BSDRouteProvider,
dns=DNSPythonProvider or DigProvider,
hosts=PosixHostsFileProvider,
domain_vpn_dns=MacSplitDNSProvider,
firewall = PfFirewallProvider if release() >= LooseVersion('10.6') else None,
# PF firewall was released with MacOS 10.6 Snow Leopard (= Darwin kernel 10.0)
# https://en.wikipedia.org/wiki/Mac_OS_X_Snow_Leopard#Release_history
firewall = PfFirewallProvider if parsed_release >= (10, 0) else None,
)
elif platform.startswith('freebsd'):
from .dnspython import DNSPythonProvider
Expand Down

0 comments on commit 4e26adb

Please sign in to comment.