Use LooseVersion to compare versions instead of strings

pull/772/head
Tim Head 2019-09-08 14:54:51 +02:00
rodzic eae42740b6
commit c50983532e
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -2,6 +2,8 @@ import re
import os
import datetime
from distutils.version import LooseVersion as V
from .python import PythonBuildPack
@ -170,7 +172,7 @@ class RBuildPack(PythonBuildPack):
]
# For R 3.4 we use the default Ubuntu package, for other versions we
# install from a different PPA
if self.r_version.startswith("3.4"):
if V(self.r_version) < V("3.5"):
packages.append("r-base")
return super().get_packages().union(packages)
@ -216,7 +218,7 @@ class RBuildPack(PythonBuildPack):
scripts = []
# For R 3.4 we want to use the default Ubuntu package but otherwise
# we use the packages from a PPA
if not self.r_version.startswith("3.4"):
if V(self.r_version) >= V("3.5"):
scripts += [
(
"root",
@ -342,7 +344,7 @@ class RBuildPack(PythonBuildPack):
if "r" in self.stencila_contexts:
# new versions of R require a different way of installing bioconductor
if self.r_version.startswith("3.4"):
if V(self.r_version) <= V("3.5"):
scripts += [
(
"${NB_USER}",