-
Notifications
You must be signed in to change notification settings - Fork 710
Data files not working in new-build projects #4639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
2 tasks
fgaz
added a commit
to fgaz/cabal
that referenced
this issue
Jul 28, 2017
Using the current directory worked with single packages, but cabal projects can use packages in different places. Fixes haskell#4639
3 tasks
fgaz
added a commit
to fgaz/cabal
that referenced
this issue
Jul 29, 2017
Using the current directory worked with single packages, but cabal projects can use packages in different places. Fixes haskell#4639
I just ran into this problem, and didn't realise you were fully aware of this already :-) As this made diff --git a/cabal-install/Distribution/Client/CmdRun.hs b/cabal-install/Distribution/Client/CmdRun.hs
index 4d49167..807c5cb 100644
--- a/cabal-install/Distribution/Client/CmdRun.hs
+++ b/cabal-install/Distribution/Client/CmdRun.hs
@@ -19,6 +19,7 @@ import Distribution.Client.Compat.Prelude
import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
+import Distribution.Client.Types (PackageLocation(..))
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
@@ -57,8 +58,6 @@ import qualified Data.Map as Map
import qualified Data.Set as Set
import System.FilePath
( (</>) )
-import System.Directory
- ( getCurrentDirectory )
runCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
@@ -203,21 +202,29 @@ runAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddo
++ exeName
++ ":\n"
++ unlines (fmap (\p -> " - in package " ++ display (elabUnitId p)) elabPkgs)
+
let exePath = binDirectoryFor (distDirLayout baseCtx)
(elaboratedShared buildCtx)
pkg
exeName
</> exeName
- curDir <- getCurrentDirectory
- let dataDirEnvVar = (pkgPathEnvVar (elabPkgDescription pkg) "datadir",
- Just $ curDir </> dataDir (elabPkgDescription pkg))
+
+ mexeDataDir <- case elabPkgSourceLocation pkg of
+ LocalUnpackedPackage d -> pure $ Just (d </> dataDir (elabPkgDescription pkg))
+ -- TODO/FIXME: figure out how to handle remaing constructors of PackageLocation
+
+ -- TODO/FIXME: dataDirEnvVars could be more than one variable, if local/inplace packages w/ package-data are involved!
+ let dataDirEnvVars = case mexeDataDir of
+ Just _ -> [(pkgPathEnvVar (elabPkgDescription pkg) "datadir",
+ mexeDataDir)]
+ Nothing -> []
args = drop 1 targetStrings
runProgramInvocation
verbosity
emptyProgramInvocation {
progInvokePath = exePath,
progInvokeArgs = args,
- progInvokeEnv = [dataDirEnvVar]
+ progInvokeEnv = dataDirEnvVars
}
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags) |
fgaz
added a commit
to fgaz/cabal
that referenced
this issue
Aug 6, 2017
Using the current directory worked with single packages, but cabal projects can use packages in different places. Fixes haskell#4639
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's the problem: https://github.com/haskell/cabal/blob/484bb6c/cabal-install/Distribution/Client/CmdRun.hs#L211
We use the current directory as the base path for data files in
new-run
, but "current directory == package root" was true only before new-build.Replacing
curDir
with the actual package root should fix this.The text was updated successfully, but these errors were encountered: