Commit 4968a283 authored by Andrew Gibiansky's avatar Andrew Gibiansky

make it work with python3

parent e6affe26
...@@ -24,7 +24,7 @@ import System.Argv0 ...@@ -24,7 +24,7 @@ import System.Argv0
import System.Directory import System.Directory
import qualified Filesystem.Path.CurrentOS as FS import qualified Filesystem.Path.CurrentOS as FS
import Data.List.Utils (split) import Data.List.Utils (split)
import Data.String.Utils (rstrip, endswith, strip) import Data.String.Utils (rstrip, endswith, strip, replace)
import Text.Printf import Text.Printf
import qualified System.IO.Strict as StrictIO import qualified System.IO.Strict as StrictIO
...@@ -245,8 +245,11 @@ buildIPython = do ...@@ -245,8 +245,11 @@ buildIPython = do
pythonVersion :: Sh Text pythonVersion :: Sh Text
pythonVersion = do pythonVersion = do
python <- path "python" python <- path "python"
versions <- run python ["-c", "import sys; print sys.version_info.major, sys.version_info.minor"] versions <- run python ["-c", "import sys; print(sys.version_info.major, sys.version_info.minor)"]
let [major, minor] = map read . split " " . strip $ unpack versions :: [Int] let replacer = replace "(" "" .
replace ")" "" .
replace "," ""
let [major, minor] = map read . split " " . strip . replacer $ unpack versions :: [Int]
return $ "python" ++ pack (show major) ++ "." ++ pack (show minor) return $ "python" ++ pack (show major) ++ "." ++ pack (show minor)
-- | Check whether IPython is properly installed. -- | Check whether IPython is properly installed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment