Commit 46f8096b authored by Gershom's avatar Gershom
Browse files

give ConstraintSourceUserConfig a filepath

parent 4d266b4d
......@@ -272,8 +272,8 @@ data ConstraintSource =
-- | Sandbox config file, which is ./cabal.sandbox.config by default.
| ConstraintSourceSandboxConfig FilePath
-- | ./cabal.config.
| ConstraintSourceUserConfig
-- | User config file, which is ./cabal.config by default.
| ConstraintSourceUserConfig FilePath
-- | Flag specified on the command line.
| ConstraintSourceCommandlineFlag
......@@ -306,7 +306,7 @@ showConstraintSource (ConstraintSourceMainConfig path) =
"main config " ++ path
showConstraintSource (ConstraintSourceSandboxConfig path) =
"sandbox config " ++ path
showConstraintSource ConstraintSourceUserConfig = "cabal.config"
showConstraintSource (ConstraintSourceUserConfig path)= "user config " ++ path
showConstraintSource ConstraintSourceCommandlineFlag = "command line flag"
showConstraintSource ConstraintSourceUserTarget = "user target"
showConstraintSource ConstraintSourceNonUpgradeablePackage =
......
......@@ -227,7 +227,7 @@ freezePackages globalFlags verbosity pkgs = do
}
}
constraint pkg =
(pkgIdToConstraint $ packageId pkg, ConstraintSourceUserConfig)
(pkgIdToConstraint $ packageId pkg, ConstraintSourceUserConfig userPackageEnvironmentFile)
where
pkgIdToConstraint pkgId =
UserConstraintVersion (packageName pkgId)
......
......@@ -284,10 +284,10 @@ inheritedPackageEnvironment verbosity pkgEnv = do
userPackageEnvironment :: Verbosity -> FilePath -> Maybe FilePath -> IO PackageEnvironment
userPackageEnvironment verbosity pkgEnvDir globalConfigLocation = do
let path = pkgEnvDir </> userPackageEnvironmentFile
minp <- readPackageEnvironmentFile ConstraintSourceUserConfig mempty path
minp <- readPackageEnvironmentFile (ConstraintSourceUserConfig path) mempty path
case (minp, globalConfigLocation) of
(Just parseRes, _) -> processConfigParse path parseRes
(_, Just globalLoc) -> maybe (warn verbosity ("no constraints file found at " ++ path) >> return mempty) (processConfigParse globalLoc) =<< readPackageEnvironmentFile ConstraintSourceUserConfig mempty globalLoc
(_, Just globalLoc) -> maybe (warn verbosity ("no constraints file found at " ++ globalLoc) >> return mempty) (processConfigParse globalLoc) =<< readPackageEnvironmentFile (ConstraintSourceUserConfig globalLoc) mempty globalLoc
_ -> return mempty
where
processConfigParse path (ParseOk warns parseResult) = do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment