From ecf786ddab0161a4f5fa84e07cced60efb1595cd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 2 Apr 2016 12:05:07 -0400 Subject: got rid of build flag to detect stack --- src/Propellor/DotDir.hs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/DotDir.hs b/src/Propellor/DotDir.hs index 43067417..21479cb1 100644 --- a/src/Propellor/DotDir.hs +++ b/src/Propellor/DotDir.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - module Propellor.DotDir where import Propellor.Message @@ -53,14 +51,11 @@ dotPropellor = do home <- myHomeDir return (home ".propellor") -data InitCfg = UseCabal | UseStack - -initCfg :: InitCfg -#ifdef USE_STACK -initCfg = UseStack -#else -initCfg = UseCabal -#endif +-- Detect if propellor was built using stack. This is somewhat of a hack. +buildSystem :: IO String +buildSystem = do + d <- Package.getLibDir + return $ if "stack-work" `isInfixOf` d then "stack" else "cabal" interactiveInit :: IO () interactiveInit = ifM (doesDirectoryExist =<< dotPropellor) @@ -125,12 +120,11 @@ setup = do section putStrLn "Let's try building the propellor configuration, to make sure it will work..." putStrLn "" + b <- buildSystem void $ boolSystem "git" [ Param "config" , Param "propellor.buildsystem" - , Param $ case initCfg of - UseCabal -> "cabal" - UseStack -> "stack" + , Param b ] buildPropellor Nothing putStrLn "" -- cgit v1.2.3