Skip to content

Commit

Permalink
Fix backwards-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart Spitzner committed Oct 24, 2015
1 parent 36174a5 commit be3f443
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions cabal-install/Distribution/Client/Status.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE CPP #-}

-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Status
Expand Down Expand Up @@ -77,14 +79,17 @@ import qualified Distribution.Simple.LocalBuildInfo as LBI

import qualified Paths_cabal_install ( version )

import System.Environment ( getExecutablePath )
import Distribution.Client.Compat.ExecutablePath ( getExecutablePath )
import System.Directory ( doesFileExist )
import System.FilePath ( splitFileName
, combine
, splitPath
, joinPath
, takeDirectory
)
#if !MIN_VERSION_base(4,8,0)
import Data.Functor ( (<$) )
#endif
import Control.Monad ( when
, forM
, guard
Expand All @@ -94,8 +99,10 @@ import Data.Version ( showVersion
)
import Data.Maybe ( isJust
)
import Data.List ( sortOn
, groupBy
import Data.List ( groupBy
, sortBy
)
import Data.Ord ( comparing
)
import Text.PrettyPrint ( empty
, ($$)
Expand All @@ -106,7 +113,11 @@ import Text.PrettyPrint ( empty
, ($+$)
, (<+>)
)
import Data.Monoid ( (<>) )
import Data.Monoid ( (<>)
#if !MIN_VERSION_base(4,8,0)
, mappend
#endif
)
import Data.List ( inits )
import Data.Foldable ( asum )

Expand Down Expand Up @@ -307,7 +318,9 @@ status verbosity globalFlags statusFlags = do
installedPackageIndex <- getInstalledPackages verbosity comp dbs conf
let pkgs = allPackages installedPackageIndex
pkgTuples = [ (root, disp $ sourcePackageId pkg) | pkg <- pkgs, root <- [x | Just x <- [pkgRoot pkg]]]
grouped = groupBy (\a b -> fst a == fst b) $ sortOn fst pkgTuples
grouped = groupBy (\a b -> fst a == fst b)
$ sortBy (comparing fst)
$ pkgTuples
groups = [(fst (head x), map snd x) | x <- grouped]
let packageDoc ps = if Cabal.fromFlag (statusPackages statusFlags)
|| Cabal.fromFlag (statusAll statusFlags)
Expand Down

0 comments on commit be3f443

Please sign in to comment.