From a4683601f675bb3fc08bf629f2128229b1c89d39 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 17 Dec 2024 08:37:22 -0500 Subject: [PATCH] . --- .../src/Distribution/Client/ProjectConfig/Legacy.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs b/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs index 5ac40174a82..220a32a67ea 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs @@ -275,8 +275,10 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project go :: [ParseUtils.Field] -> [ParseUtils.Field] -> IO (ProjectParseResult ProjectConfigSkeleton) go acc (x : xs) = case x of (ParseUtils.F _ "import" importLoc) -> do + let importLocPath = importLoc `consProjectConfigPath` source + -- Once we canonicalize the import path, we can check for cyclical imports - normLocPath <- canonicalizeConfigPath projectDir $ importLoc `consProjectConfigPath` source + normLocPath <- canonicalizeConfigPath projectDir importLocPath debug verbosity $ "\nimport path, normalized\n=======================\n" ++ render (docProjectConfigPath normLocPath) if isCyclicConfigPath normLocPath @@ -284,7 +286,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project else do normSource <- canonicalizeConfigPath projectDir source let fs = (\z -> CondNode z [normLocPath] mempty) <$> fieldsToConfig normSource (reverse acc) - res <- parseProjectSkeleton cacheDir httpTransport verbosity projectDir normLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath + res <- parseProjectSkeleton cacheDir httpTransport verbosity projectDir importLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath rest <- go [] xs pure . fmap mconcat . sequence $ [projectParse Nothing normSource fs, res, rest] (ParseUtils.Section l "if" p xs') -> do