Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Dec 17, 2024
1 parent 120fe42 commit a468360
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,18 @@ 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
then pure . projectParseFail Nothing (Just source) $ ParseUtils.FromString (render $ cyclicalImportMsg normLocPath) Nothing
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
Expand Down

0 comments on commit a468360

Please sign in to comment.