Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
215668fc
Commit
215668fc
authored
Dec 27, 2013
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run setup if no haskell profile exists. Closes #65.
parent
b82c1577
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
IPython.hs
IHaskell/IPython.hs
+16
-3
No files found.
IHaskell/IPython.hs
View file @
215668fc
...
...
@@ -33,9 +33,11 @@ ipython suppress args = do
putStrLn
"Could not find `ipython` executable."
fail
"`ipython` not on $PATH."
Just
ipythonPath
->
runHandles
ipythonPath
args
handles
doNothing
where
handles
=
[
InHandle
Inherit
,
outHandle
suppress
,
ErrorHandle
Inherit
]
where
handles
=
[
InHandle
Inherit
,
outHandle
suppress
,
errorHandle
suppress
]
outHandle
True
=
OutHandle
CreatePipe
outHandle
False
=
OutHandle
Inherit
errorHandle
True
=
ErrorHandle
CreatePipe
errorHandle
False
=
ErrorHandle
Inherit
doNothing
_
stdout
_
=
if
suppress
then
liftIO
$
StrictIO
.
hGetContents
stdout
else
return
""
...
...
@@ -59,14 +61,25 @@ runIHaskell :: String -- ^ IHaskell profile name.
->
String
-- ^ IPython app name.
->
[
String
]
-- ^ Arguments to IPython.
->
IO
()
runIHaskell
profile
app
args
=
void
.
shelly
.
ipython
False
$
[
pack
app
,
"--profile"
,
pack
profile
]
++
map
pack
args
runIHaskell
profile
app
args
=
void
.
shelly
$
do
-- Try to locate the profile. Do not die if it doesn't exist.
errExit
False
$
ipython
True
[
"locate"
,
"profile"
,
pack
profile
]
-- If the profile doesn't exist, create it.
exitCode
<-
lastExitCode
when
(
exitCode
/=
0
)
$
liftIO
$
do
putStrLn
"Creating IPython profile."
setupIPythonProfile
profile
-- Run the IHaskell command.
ipython
False
$
map
pack
$
[
app
,
"--profile"
,
profile
]
++
args
-- | Create the IPython profile.
setupIPythonProfile
::
String
-- ^ IHaskell profile name.
->
IO
()
setupIPythonProfile
profile
=
shelly
$
do
-- Create the IPython profile.
void
$
ipython
Fals
e
[
"profile"
,
"create"
,
pack
profile
]
void
$
ipython
Tru
e
[
"profile"
,
"create"
,
pack
profile
]
-- Find the IPython profile directory. Make sure to get rid of trailing
-- newlines from the output of the `ipython locate` call.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment