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
fe3bbf32
Commit
fe3bbf32
authored
Mar 18, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated to new Shelly. Fixed Ctrl-C quitting issues.
parent
47e0bbec
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
146 additions
and
162 deletions
+146
-162
ihaskell.cabal
ihaskell.cabal
+2
-2
Test.ipynb
notebooks/Test.ipynb
+123
-139
ipython_console_config.py
profile/ipython_console_config.py
+1
-0
BrokenPackages.hs
src/IHaskell/BrokenPackages.hs
+1
-1
IPython.hs
src/IHaskell/IPython.hs
+19
-20
No files found.
ihaskell.cabal
View file @
fe3bbf32
...
@@ -80,7 +80,7 @@ library
...
@@ -80,7 +80,7 @@ library
parsec -any,
parsec -any,
process >=1.1,
process >=1.1,
random >=1.0,
random >=1.0,
shelly ==1.
3.* || >= 1.4.4.2
,
shelly ==1.
5.*
,
split >= 0.2,
split >= 0.2,
strict >=0.3,
strict >=0.3,
system-argv0 -any,
system-argv0 -any,
...
@@ -173,7 +173,7 @@ Test-Suite hspec
...
@@ -173,7 +173,7 @@ Test-Suite hspec
process >=1.1,
process >=1.1,
random >=1.0,
random >=1.0,
setenv -any,
setenv -any,
shelly ==1.
3.* || >= 1.4.4.2
,
shelly ==1.
5.*
,
split >= 0.2,
split >= 0.2,
strict >=0.3,
strict >=0.3,
system-argv0 -any,
system-argv0 -any,
...
...
notebooks/Test.ipynb
View file @
fe3bbf32
This diff is collapsed.
Click to expand it.
profile/ipython_console_config.py
View file @
fe3bbf32
# Empty.
# Empty.
c
=
get_config
()
c
=
get_config
()
c
.
TerminalIPythonApp
.
display_banner
=
False
c
.
TerminalIPythonApp
.
display_banner
=
False
c
.
TerminalInteractiveShell
.
confirm_exit
=
False
src/IHaskell/BrokenPackages.hs
View file @
fe3bbf32
...
@@ -20,7 +20,7 @@ instance Show BrokenPackage where
...
@@ -20,7 +20,7 @@ instance Show BrokenPackage where
show
=
packageID
show
=
packageID
getBrokenPackages
::
IO
[
String
]
getBrokenPackages
::
IO
[
String
]
getBrokenPackages
=
shelly
NoDir
$
do
getBrokenPackages
=
shelly
$
do
silently
$
errExit
False
$
run
"ghc-pkg"
[
"check"
]
silently
$
errExit
False
$
run
"ghc-pkg"
[
"check"
]
checkOut
<-
lastStderr
checkOut
<-
lastStderr
...
...
src/IHaskell/IPython.hs
View file @
fe3bbf32
...
@@ -32,6 +32,7 @@ import qualified Paths_ihaskell as Paths
...
@@ -32,6 +32,7 @@ import qualified Paths_ihaskell as Paths
import
qualified
Codec.Archive.Tar
as
Tar
import
qualified
Codec.Archive.Tar
as
Tar
import
IHaskell.Types
import
IHaskell.Types
import
System.Posix.Signals
-- | Which IPython to use.
-- | Which IPython to use.
data
WhichIPython
data
WhichIPython
...
@@ -60,11 +61,9 @@ ipython which suppress args
...
@@ -60,11 +61,9 @@ ipython which suppress args
-- If we have PYTHONDONTWRITEBYTECODE enabled, everything breaks.
-- If we have PYTHONDONTWRITEBYTECODE enabled, everything breaks.
setenv
"PYTHONDONTWRITEBYTECODE"
""
setenv
"PYTHONDONTWRITEBYTECODE"
""
-- We have this because `silently` in shelly < 1.4 does not silence
liftIO
$
installHandler
keyboardSignal
(
CatchOnce
$
return
()
)
Nothing
-- stderr. In shelly 1.4, however, using `run` does not let us use stdin,
-- and the current code breaks for unknown reasons. When the bug
-- We have this because using `run` does not let us use stdin.
-- https://github.com/yesodweb/Shelly.hs/issues/54
-- is closed, we should edit ihaskell.cabal to allow shelly 1.4.
runHandles
"bash"
cmdArgs
handles
doNothing
runHandles
"bash"
cmdArgs
handles
doNothing
|
otherwise
=
do
|
otherwise
=
do
let
ExplicitIPython
exe
=
which
let
ExplicitIPython
exe
=
which
...
@@ -114,10 +113,10 @@ ipythonSourceDir :: Sh FilePath
...
@@ -114,10 +113,10 @@ ipythonSourceDir :: Sh FilePath
ipythonSourceDir
=
ensure
$
(
</>
"ipython-src"
)
<$>
ihaskellDir
ipythonSourceDir
=
ensure
$
(
</>
"ipython-src"
)
<$>
ihaskellDir
getIHaskellDir
::
IO
String
getIHaskellDir
::
IO
String
getIHaskellDir
=
shelly
NoDir
$
fpToString
<$>
ihaskellDir
getIHaskellDir
=
shelly
$
fpToString
<$>
ihaskellDir
defaultConfFile
::
IO
(
Maybe
String
)
defaultConfFile
::
IO
(
Maybe
String
)
defaultConfFile
=
shelly
NoDir
$
do
defaultConfFile
=
shelly
$
do
filename
<-
(
</>
"rc.hs"
)
<$>
ihaskellDir
filename
<-
(
</>
"rc.hs"
)
<$>
ihaskellDir
exists
<-
test_f
filename
exists
<-
test_f
filename
return
$
if
exists
return
$
if
exists
...
@@ -128,7 +127,7 @@ defaultConfFile = shellyNoDir $ do
...
@@ -128,7 +127,7 @@ defaultConfFile = shellyNoDir $ do
-- Notebooks are searched in the current directory as well as the IHaskell
-- Notebooks are searched in the current directory as well as the IHaskell
-- notebook directory (in that order).
-- notebook directory (in that order).
nbconvert
::
WhichIPython
->
ViewFormat
->
String
->
IO
()
nbconvert
::
WhichIPython
->
ViewFormat
->
String
->
IO
()
nbconvert
which
fmt
name
=
void
.
shelly
NoDir
$
do
nbconvert
which
fmt
name
=
void
.
shelly
$
do
curdir
<-
pwd
curdir
<-
pwd
nbdir
<-
notebookDir
nbdir
<-
notebookDir
...
@@ -157,7 +156,7 @@ nbconvert which fmt name = void . shellyNoDir $ do
...
@@ -157,7 +156,7 @@ nbconvert which fmt name = void . shellyNoDir $ do
setupIPython
::
WhichIPython
->
IO
()
setupIPython
::
WhichIPython
->
IO
()
setupIPython
(
ExplicitIPython
path
)
=
do
setupIPython
(
ExplicitIPython
path
)
=
do
exists
<-
shelly
NoDir
$
exists
<-
shelly
$
test_f
$
fromString
path
test_f
$
fromString
path
unless
exists
$
unless
exists
$
...
@@ -172,7 +171,7 @@ setupIPython DefaultIPython = do
...
@@ -172,7 +171,7 @@ setupIPython DefaultIPython = do
-- | Replace "~" with $HOME if $HOME is defined.
-- | Replace "~" with $HOME if $HOME is defined.
-- Otherwise, do nothing.
-- Otherwise, do nothing.
subHome
::
String
->
IO
String
subHome
::
String
->
IO
String
subHome
path
=
shelly
NoDir
$
do
subHome
path
=
shelly
$
do
home
<-
unpack
<$>
fromMaybe
"~"
<$>
get_env
"HOME"
home
<-
unpack
<$>
fromMaybe
"~"
<$>
get_env
"HOME"
return
$
replace
"~"
home
path
return
$
replace
"~"
home
path
...
@@ -217,12 +216,12 @@ runIHaskell which profile app args = void $ do
...
@@ -217,12 +216,12 @@ runIHaskell which profile app args = void $ do
ipython
which
False
$
map
pack
$
[
app
,
"--profile"
,
profile
]
++
args
ipython
which
False
$
map
pack
$
[
app
,
"--profile"
,
profile
]
++
args
runConsole
::
WhichIPython
->
InitInfo
->
IO
()
runConsole
::
WhichIPython
->
InitInfo
->
IO
()
runConsole
which
initInfo
=
void
.
shelly
NoDir
$
do
runConsole
which
initInfo
=
void
.
shelly
$
do
writeInitInfo
initInfo
writeInitInfo
initInfo
runIHaskell
which
ipythonProfile
"console"
[]
runIHaskell
which
ipythonProfile
"console"
[]
runNotebook
::
WhichIPython
->
InitInfo
->
Maybe
String
->
IO
()
runNotebook
::
WhichIPython
->
InitInfo
->
Maybe
String
->
IO
()
runNotebook
which
initInfo
maybeServeDir
=
void
.
shelly
NoDir
$
do
runNotebook
which
initInfo
maybeServeDir
=
void
.
shelly
$
do
notebookDirStr
<-
fpToString
<$>
notebookDir
notebookDirStr
<-
fpToString
<$>
notebookDir
let
args
=
case
maybeServeDir
of
let
args
=
case
maybeServeDir
of
Nothing
->
[
"--notebook-dir"
,
unpack
notebookDirStr
]
Nothing
->
[
"--notebook-dir"
,
unpack
notebookDirStr
]
...
@@ -237,7 +236,7 @@ writeInitInfo info = do
...
@@ -237,7 +236,7 @@ writeInitInfo info = do
liftIO
$
writeFile
filename
$
show
info
liftIO
$
writeFile
filename
$
show
info
readInitInfo
::
IO
InitInfo
readInitInfo
::
IO
InitInfo
readInitInfo
=
shelly
NoDir
$
do
readInitInfo
=
shelly
$
do
filename
<-
(
</>
".last-arguments"
)
<$>
ihaskellDir
filename
<-
(
</>
".last-arguments"
)
<$>
ihaskellDir
read
<$>
liftIO
(
readFile
filename
)
read
<$>
liftIO
(
readFile
filename
)
...
@@ -245,7 +244,7 @@ readInitInfo = shellyNoDir $ do
...
@@ -245,7 +244,7 @@ readInitInfo = shellyNoDir $ do
setupIPythonProfile
::
WhichIPython
setupIPythonProfile
::
WhichIPython
->
String
-- ^ IHaskell profile name.
->
String
-- ^ IHaskell profile name.
->
IO
()
->
IO
()
setupIPythonProfile
which
profile
=
shelly
NoDir
$
do
setupIPythonProfile
which
profile
=
shelly
$
do
-- Create the IPython profile.
-- Create the IPython profile.
void
$
ipython
which
True
[
"profile"
,
"create"
,
pack
profile
]
void
$
ipython
which
True
[
"profile"
,
"create"
,
pack
profile
]
...
@@ -314,7 +313,7 @@ getIHaskellPath = do
...
@@ -314,7 +313,7 @@ getIHaskellPath = do
return
$
FS
.
encodeString
$
FS
.
decodeString
cd
FS
.</>
f
return
$
FS
.
encodeString
$
FS
.
decodeString
cd
FS
.</>
f
getSandboxPackageConf
::
IO
(
Maybe
String
)
getSandboxPackageConf
::
IO
(
Maybe
String
)
getSandboxPackageConf
=
shelly
NoDir
$
do
getSandboxPackageConf
=
shelly
$
do
myPath
<-
getIHaskellPath
myPath
<-
getIHaskellPath
let
sandboxName
=
".cabal-sandbox"
let
sandboxName
=
".cabal-sandbox"
if
not
$
sandboxName
`
isInfixOf
`
myPath
if
not
$
sandboxName
`
isInfixOf
`
myPath
...
@@ -331,7 +330,7 @@ getSandboxPackageConf = shellyNoDir $ do
...
@@ -331,7 +330,7 @@ getSandboxPackageConf = shellyNoDir $ do
-- | Check whether IPython is properly installed.
-- | Check whether IPython is properly installed.
ipythonInstalled
::
IO
Bool
ipythonInstalled
::
IO
Bool
ipythonInstalled
=
shelly
NoDir
$
do
ipythonInstalled
=
shelly
$
do
ipythonPath
<-
ipythonExePath
DefaultIPython
ipythonPath
<-
ipythonExePath
DefaultIPython
test_f
ipythonPath
test_f
ipythonPath
...
@@ -339,12 +338,12 @@ ipythonInstalled = shellyNoDir $ do
...
@@ -339,12 +338,12 @@ ipythonInstalled = shellyNoDir $ do
updateIPython
::
IO
()
updateIPython
::
IO
()
updateIPython
=
do
updateIPython
=
do
updateScript
<-
Paths
.
getDataFileName
"installation/update.sh"
updateScript
<-
Paths
.
getDataFileName
"installation/update.sh"
venv
<-
fpToText
<$>
shelly
NoDir
ipythonDir
venv
<-
fpToText
<$>
shelly
ipythonDir
runTmp
updateScript
[
venv
,
ipythonCommit
]
runTmp
updateScript
[
venv
,
ipythonCommit
]
-- Remove the old IPython profile.
-- Remove the old IPython profile.
-- A new one will be regenerated when it is needed.
-- A new one will be regenerated when it is needed.
-- shelly
NoDir
$ removeIPythonProfile DefaultIPython ipythonProfile
-- shelly $ removeIPythonProfile DefaultIPython ipythonProfile
-- | Install IPython from source.
-- | Install IPython from source.
installIPython
::
IO
()
installIPython
::
IO
()
...
@@ -355,13 +354,13 @@ installIPython = do
...
@@ -355,13 +354,13 @@ installIPython = do
-- Set up the virtualenv.
-- Set up the virtualenv.
virtualenvScript
<-
Paths
.
getDataFileName
"installation/virtualenv.sh"
virtualenvScript
<-
Paths
.
getDataFileName
"installation/virtualenv.sh"
venvDir
<-
fpToText
<$>
shelly
NoDir
ipythonDir
venvDir
<-
fpToText
<$>
shelly
ipythonDir
runTmp
virtualenvScript
[
venvDir
]
runTmp
virtualenvScript
[
venvDir
]
-- Set up Python depenencies.
-- Set up Python depenencies.
installScript
<-
Paths
.
getDataFileName
"installation/ipython.sh"
installScript
<-
Paths
.
getDataFileName
"installation/ipython.sh"
runTmp
installScript
[
venvDir
,
ipythonCommit
]
runTmp
installScript
[
venvDir
,
ipythonCommit
]
runTmp
script
args
=
shelly
NoDir
$
withTmpDir
$
\
tmp
->
do
runTmp
script
args
=
shelly
$
withTmpDir
$
\
tmp
->
do
cd
tmp
cd
tmp
run_
"bash"
$
pack
script
:
args
run_
"bash"
$
pack
script
:
args
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