Skip to content

Commit

Permalink
use parse_version
Browse files Browse the repository at this point in the history
close #29
  • Loading branch information
randy3k committed Oct 18, 2023
1 parent 737a8ba commit d8227a9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rchitect/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import sys
import ctypes
import locale
from distutils.version import LooseVersion
if sys.version_info[0] >= 3:
from shutil import which
from shutil import which

if sys.version_info[:3] >= (3, 12, 0)
from pkg_resources import parse_version
else:
from backports.shutil_which import which
from distutils.version import LooseVersion as parse_version

if sys.platform.startswith('win'):
if sys.version_info[0] >= 3:
Expand Down Expand Up @@ -121,9 +122,9 @@ def rversion(rhome=None):
output = subprocess.check_output(
[os.path.join(rhome, "bin", "R"), "--slave", "-e", "cat(as.character(getRversion()))"],
stderr=subprocess.STDOUT).decode("utf-8").strip()
version = LooseVersion(output)
version = parse_version(output)
except Exception:
version = LooseVersion("1000.0.0")
version = parse_version("1000.0.0")
return version


Expand Down

0 comments on commit d8227a9

Please sign in to comment.