You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Data files not working in new-build projects #4639
I just ran into this problem, and didn't realise you were fully aware of this already :-)
As this made new-run unusable for some of my use-case, I had to yak-shave and fix this in my local cabal, and here's what I did including a few TODO-notes on what is missing:
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)
Activity
Use package root as data-file base path, not cwd
Use package root as data-file base path, not cwd
hvr commentedon Aug 5, 2017
I just ran into this problem, and didn't realise you were fully aware of this already :-)
As this made
new-rununusable for some of my use-case, I had to yak-shave and fix this in my localcabal, and here's what I did including a few TODO-notes on what is missing:Use package root as data-file base path, not cwd