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
666484d7
Commit
666484d7
authored
Jan 09, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding support for running from a sandbox
parent
c7708acc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+11
-1
IPython.hs
src/IHaskell/IPython.hs
+18
-1
No files found.
src/IHaskell/Eval/Evaluate.hs
View file @
666484d7
...
@@ -116,9 +116,19 @@ interpret allowedStdin action = runGhc (Just libdir) $ do
...
@@ -116,9 +116,19 @@ interpret allowedStdin action = runGhc (Just libdir) $ do
-- Set the dynamic session flags
-- Set the dynamic session flags
originalFlags
<-
getSessionDynFlags
originalFlags
<-
getSessionDynFlags
let
dflags
=
xopt_set
originalFlags
Opt_ExtendedDefaultRules
let
dflags
=
xopt_set
originalFlags
Opt_ExtendedDefaultRules
-- If we're in a sandbox, add the relevant package database
sandboxPackages
<-
liftIO
getSandboxPackageConf
let
pkgConfs
=
case
sandboxPackages
of
Nothing
->
extraPkgConfs
dflags
Just
path
->
let
pkg
=
PkgConfFile
path
in
(
pkg
:
)
.
extraPkgConfs
dflags
void
$
setSessionDynFlags
$
dflags
{
hscTarget
=
HscInterpreted
,
void
$
setSessionDynFlags
$
dflags
{
hscTarget
=
HscInterpreted
,
ghcLink
=
LinkInMemory
,
ghcLink
=
LinkInMemory
,
pprCols
=
300
}
pprCols
=
300
,
extraPkgConfs
=
pkgConfs
}
initializeImports
initializeImports
...
...
src/IHaskell/IPython.hs
View file @
666484d7
...
@@ -12,6 +12,7 @@ module IHaskell.IPython (
...
@@ -12,6 +12,7 @@ module IHaskell.IPython (
readInitInfo
,
readInitInfo
,
defaultConfFile
,
defaultConfFile
,
getIHaskellDir
,
getIHaskellDir
,
getSandboxPackageConf
,
nbconvert
,
nbconvert
,
ViewFormat
(
..
),
ViewFormat
(
..
),
)
where
)
where
...
@@ -23,7 +24,7 @@ import System.Argv0
...
@@ -23,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
)
import
Data.String.Utils
(
rstrip
,
endswith
)
import
Text.Printf
import
Text.Printf
import
qualified
System.IO.Strict
as
StrictIO
import
qualified
System.IO.Strict
as
StrictIO
...
@@ -391,3 +392,19 @@ getIHaskellPath = do
...
@@ -391,3 +392,19 @@ getIHaskellPath = do
-- If it's actually a relative path, make it absolute.
-- If it's actually a relative path, make it absolute.
cd
<-
liftIO
getCurrentDirectory
cd
<-
liftIO
getCurrentDirectory
return
$
FS
.
encodeString
$
FS
.
decodeString
cd
FS
.</>
f
return
$
FS
.
encodeString
$
FS
.
decodeString
cd
FS
.</>
f
getSandboxPackageConf
::
IO
(
Maybe
String
)
getSandboxPackageConf
=
shellyNoDir
$
do
myPath
<-
getIHaskellPath
let
sandboxName
=
".cabal-sandbox"
if
not
$
sandboxName
`
isInfixOf
`
myPath
then
return
Nothing
else
do
let
pieces
=
split
"/"
myPath
sandboxDir
=
intercalate
"/"
$
(
takeWhile
(
/=
sandboxName
)
pieces
)
++
[
sandboxName
]
subdirs
<-
ls
$
fpFromString
sandboxDir
let
confdirs
=
filter
(
endswith
"packages.conf.d"
)
$
map
fpToString
subdirs
case
confdirs
of
[]
->
return
Nothing
dir
:
_
->
return
$
Just
dir
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