aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2015-08-12 06:58:32 +0200
committerDaniel Gröber <dxld@darkboxed.org>2015-08-12 06:58:32 +0200
commite6ff6a7f5615294aa90b7f3ae6a2a8111a8e1540 (patch)
tree674cf95ba561f22a63cbfc499d53a331c370b70e
parent58d6a5bbab4858ec3906074e8badd6b4f47b8e7f (diff)
Fix tests
-rw-r--r--CabalHelper/Main.hs2
-rw-r--r--Distribution/Helper.hs10
-rw-r--r--cabal-helper.cabal1
-rw-r--r--tests/Spec.hs3
4 files changed, 10 insertions, 6 deletions
diff --git a/CabalHelper/Main.hs b/CabalHelper/Main.hs
index 0177cf5..290584d 100644
--- a/CabalHelper/Main.hs
+++ b/CabalHelper/Main.hs
@@ -159,8 +159,6 @@ main = do
print =<< flip mapM cmds $$ \cmd -> do
case cmd of
"write-autogen-files":[] -> do
- -- can't use @projdir@ here
- let pd = localPkgDescr lbi
-- calls writeAutogenFiles
initialBuildSteps distdir pd lbi v
return Nothing
diff --git a/Distribution/Helper.hs b/Distribution/Helper.hs
index da07510..3544d2e 100644
--- a/Distribution/Helper.hs
+++ b/Distribution/Helper.hs
@@ -265,11 +265,15 @@ getSomeConfigState = ask >>= \(QueryEnv readProc progs projdir distdir) -> do
-- in the usual place.
writeAutogenFiles :: MonadIO m
=> (FilePath -> [String] -> String -> IO String)
- -> FilePath -- ^ Path to the @dist/@ directory
+ -> FilePath
+ -- ^ Path to project directory, i.e. the one containing the
+ -- @project.cabal@ file
+ -> FilePath
+ -- ^ Path to the @dist/@ directory
-> m ()
-writeAutogenFiles readProc distdir = liftIO $ do
+writeAutogenFiles readProc projdir distdir = liftIO $ do
exe <- findLibexecExe "cabal-helper-wrapper"
- void $ readProc exe ["/nowhere/../..", distdir, "write-autogen-files"] ""
+ void $ readProc exe [projdir, distdir, "write-autogen-files"] ""
-- | Get the path to the sandbox package-db in a project
getSandboxPkgDb :: (FilePath -> [String] -> String -> IO String)
diff --git a/cabal-helper.cabal b/cabal-helper.cabal
index c7fe730..9b0f455 100644
--- a/cabal-helper.cabal
+++ b/cabal-helper.cabal
@@ -90,3 +90,4 @@ Test-Suite spec
, cabal-helper
, extra
, unix
+ , process
diff --git a/tests/Spec.hs b/tests/Spec.hs
index b1a0313..296702e 100644
--- a/tests/Spec.hs
+++ b/tests/Spec.hs
@@ -1,10 +1,11 @@
import Distribution.Helper
import System.Environment.Extra (lookupEnv)
import System.Posix.Env (setEnv)
+import System.Process
import Data.Maybe
import Data.Functor
main :: IO ()
main = do
flip (setEnv "HOME") True =<< fromMaybe "/tmp" <$> lookupEnv "TMPDIR"
- writeAutogenFiles "./dist"
+ writeAutogenFiles readProcess "." "./dist"