Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
d53b4fb5
Commit
d53b4fb5
authored
Dec 04, 2014
by
Christiaan Baaij
Browse files
Don't use 'lookupEnv' in 'addLibraryPaths'
parent
dd0eaeba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Simple/Test/ExeV10.hs
View file @
d53b4fb5
...
...
@@ -87,7 +87,7 @@ runTest pkg_descr lbi flags suite = do
clbi
=
LBI
.
getComponentLocalBuildInfo
lbi
(
LBI
.
CTestName
(
PD
.
testName
suite
))
paths
<-
LBI
.
depLibraryPaths
True
False
lbi
clbi
addLibraryPath
os
paths
shellEnv
return
(
addLibraryPath
os
paths
shellEnv
)
else
return
shellEnv
exit
<-
rawSystemIOWithEnv
verbosity
cmd
opts
Nothing
(
Just
shellEnv'
)
...
...
Cabal/Distribution/Simple/Test/LibV09.hs
View file @
d53b4fb5
...
...
@@ -98,7 +98,7 @@ runTest pkg_descr lbi flags suite = do
(
PD
.
testName
suite
))
paths
<-
LBI
.
depLibraryPaths
True
False
lbi
clbi
addLibraryPath
os
paths
shellEnv
return
(
addLibraryPath
os
paths
shellEnv
)
else
return
shellEnv
rawSystemIOWithEnv
verbosity
cmd
opts
Nothing
(
Just
shellEnv'
)
-- these handles are closed automatically
...
...
Cabal/Distribution/Simple/Utils.hs
View file @
d53b4fb5
...
...
@@ -128,8 +128,6 @@ module Distribution.Simple.Utils (
wrapLine
,
)
where
import
Data.Functor
(
(
<$>
)
)
import
Control.Monad
(
join
,
when
,
unless
,
filterM
)
import
Control.Concurrent.MVar
...
...
@@ -149,7 +147,7 @@ import System.Directory
,
doesDirectoryExist
,
doesFileExist
,
removeFile
,
findExecutable
,
getModificationTime
)
import
System.Environment
(
getProgName
,
lookupEnv
)
(
getProgName
)
import
System.Exit
(
exitWith
,
ExitCode
(
..
)
)
import
System.FilePath
...
...
@@ -703,16 +701,21 @@ isInSearchPath path = fmap (elem path) getSearchPath
addLibraryPath
::
OS
->
[
FilePath
]
->
[(
String
,
String
)]
->
IO
[(
String
,
String
)]
addLibraryPath
os
paths
env
=
do
let
libPaths
=
intercalate
[
searchPathSeparator
]
paths
ldPath
=
case
os
of
OSX
->
"DYLD_LIBRARY_PATH"
_
->
"LD_LIBRARY_PATH"
ldEnv
<-
maybe
libPaths
(
++
(
searchPathSeparator
:
libPaths
))
<$>
lookupEnv
ldPath
return
(
env
++
[(
ldPath
,
ldEnv
)])
->
[(
String
,
String
)]
addLibraryPath
os
paths
=
addEnv
where
pathsString
=
intercalate
[
searchPathSeparator
]
paths
ldPath
=
case
os
of
OSX
->
"DYLD_LIBRARY_PATH"
_
->
"LD_LIBRARY_PATH"
addEnv
[]
=
[(
ldPath
,
pathsString
)]
addEnv
((
key
,
value
)
:
xs
)
|
key
==
ldPath
=
if
null
value
then
(
key
,
pathsString
)
:
xs
else
(
key
,
value
++
(
searchPathSeparator
:
pathsString
))
:
xs
|
otherwise
=
(
key
,
value
)
:
addEnv
xs
----------------
-- File globbing
...
...
cabal-install/Distribution/Client/Run.hs
View file @
d53b4fb5
...
...
@@ -72,7 +72,7 @@ run verbosity lbi exe exeArgs = do
clbi
=
getComponentLocalBuildInfo
lbi
(
CExeName
(
exeName
exe
))
paths
<-
depLibraryPaths
True
False
lbi
clbi
addLibraryPath
os
paths
env
return
(
addLibraryPath
os
paths
env
)
else
return
env
notice
verbosity
$
"Running "
++
exeName
exe
++
"..."
rawSystemExitWithEnv
verbosity
path
exeArgs
env'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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