[commit: Cabal] master: Default to global installs on Windows (39527b1)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:56:16 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/39527b19ca4f1a29ca8514ec3f28c8c63b704509
>---------------------------------------------------------------
commit 39527b19ca4f1a29ca8514ec3f28c8c63b704509
Author: Duncan Coutts <duncan at haskell.org>
Date: Mon Jun 16 22:38:47 2008 +0000
Default to global installs on Windows
User installs by default elsewhere. Note that this default only
affects new config files. Existing windows users will need to
change their config file or delete it and let it be re-created.
>---------------------------------------------------------------
cabal-install/Hackage/Config.hs | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/cabal-install/Hackage/Config.hs b/cabal-install/Hackage/Config.hs
index 93e47c7..b922f0a 100644
--- a/cabal-install/Hackage/Config.hs
+++ b/cabal-install/Hackage/Config.hs
@@ -47,6 +47,8 @@ import Distribution.Simple.Setup
import qualified Distribution.Simple.Setup as ConfigFlags
import qualified Distribution.Simple.Setup as Cabal
import Distribution.Verbosity (Verbosity, normal)
+import Distribution.System
+ ( OS(Windows), buildOS )
import Hackage.Types
( RemoteRepo(..), Repo(..), Username(..), Password(..) )
@@ -116,6 +118,13 @@ defaultCacheDir = do dir <- defaultCabalDir
defaultCompiler :: CompilerFlavor
defaultCompiler = fromMaybe GHC defaultCompilerFlavor
+defaultUserInstall :: Bool
+defaultUserInstall = case buildOS of
+ -- We do global installs by default on Windows
+ Windows -> False
+ -- and per-user installs by default everywhere else
+ _ -> True
+
defaultUserInstallDirs :: IO (InstallDirs (Flag PathTemplate))
defaultUserInstallDirs =
do userPrefix <- defaultCabalDir
@@ -130,15 +139,15 @@ defaultSavedConfig :: IO SavedConfig
defaultSavedConfig =
do userInstallDirs <- defaultUserInstallDirs
cacheDir <- defaultCacheDir
- return SavedConfig
- { configFlags = mempty {
- ConfigFlags.configHcFlavor = toFlag defaultCompiler
- , ConfigFlags.configVerbosity = toFlag normal
- , ConfigFlags.configUserInstall = toFlag True
- , ConfigFlags.configInstallDirs = error
- "ConfigFlags.installDirs: avoid this field. Use UserInstallDirs \
- \ or GlobalInstallDirs instead"
- }
+ return SavedConfig {
+ configFlags = mempty {
+ ConfigFlags.configHcFlavor = toFlag defaultCompiler
+ , ConfigFlags.configVerbosity = toFlag normal
+ , ConfigFlags.configUserInstall = toFlag defaultUserInstall
+ , ConfigFlags.configInstallDirs = error
+ "ConfigFlags.installDirs: avoid this field. Use UserInstallDirs \
+ \ or GlobalInstallDirs instead"
+ }
, configUserInstallDirs = userInstallDirs
, configGlobalInstallDirs = defaultGlobalInstallDirs
, configCacheDir = toFlag cacheDir
More information about the Cvs-libraries
mailing list