@@ -32,6 +32,7 @@ import Distribution.Types.BenchmarkType
32
32
import Distribution.Types.LibraryName
33
33
import Distribution.Types.PkgconfigVersion
34
34
import Distribution.Types.TestType
35
+ import Distribution.Types.VersionRange.Internal ()
35
36
import Distribution.Version
36
37
import Text.PrettyPrint
37
38
@@ -144,6 +145,32 @@ data CabalException
144
145
| CheckPackageProblems [String ]
145
146
| LibDirDepsPrefixNotRelative FilePath FilePath
146
147
| CombinedConstraints Doc
148
+ | CantParseGHCOutput
149
+ | IncompatibleWithCabal String String
150
+ | Couldn'tFindTestProgram FilePath
151
+ | TestCoverageSupport
152
+ | Couldn'tFindTestProgLibV09 FilePath
153
+ | TestCoverageSupportLibV09
154
+ | RawSystemStdout String
155
+ | FindFileCwd FilePath
156
+ | FindFileEx FilePath
157
+ | FindModuleFileEx ModuleName [String ] [FilePath ]
158
+ | MultipleFilesWithExtension String
159
+ | NoDesc
160
+ | MultiDesc [String ]
161
+ | RelocRegistrationInfo
162
+ | CreatePackageDB
163
+ | WithHcPkg String
164
+ | RegisMultiplePkgNotSupported
165
+ | RegisteringNotImplemented
166
+ | NoTestSuitesEnabled
167
+ | TestNameDisabled String
168
+ | NoSuchTest String
169
+ | ConfigureProgram String FilePath
170
+ | RequireProgram String
171
+ | NoProgramFound String VersionRange
172
+ | BadVersionDb String Version VersionRange FilePath
173
+ | UnknownVersionDb String VersionRange FilePath
147
174
deriving (Show , Typeable )
148
175
149
176
exceptionCode :: CabalException -> Int
@@ -249,6 +276,37 @@ exceptionCode e = case e of
249
276
CheckPackageProblems {} -> 5559
250
277
LibDirDepsPrefixNotRelative {} -> 6667
251
278
CombinedConstraints {} -> 5000
279
+ CantParseGHCOutput {} -> 1980
280
+ IncompatibleWithCabal {} -> 8123
281
+ Couldn'tFindTestProgram {} -> 5678
282
+ TestCoverageSupport {} -> 7890
283
+ Couldn'tFindTestProgLibV09 {} -> 9012
284
+ TestCoverageSupportLibV09 {} -> 1076
285
+ RawSystemStdout {} -> 3098
286
+ FindFileCwd {} -> 4765
287
+ FindFileEx {} -> 2115
288
+ FindModuleFileEx {} -> 6663
289
+ MultipleFilesWithExtension {} -> 3333
290
+ NoDesc {} -> 7654
291
+ MultiDesc {} -> 5554
292
+ RelocRegistrationInfo {} -> 4343
293
+ CreatePackageDB {} -> 6787
294
+ WithHcPkg {} -> 9876
295
+ RegisMultiplePkgNotSupported {} -> 7632
296
+ RegisteringNotImplemented {} -> 5411
297
+ NoTestSuitesEnabled {} -> 9061
298
+ TestNameDisabled {} -> 8210
299
+ NoSuchTest {} -> 8000
300
+ ConfigureProgram {} -> 5490
301
+ RequireProgram {} -> 6666
302
+ NoProgramFound {} -> 7620
303
+ BadVersionDb {} -> 8038
304
+ UnknownVersionDb {} -> 1008
305
+
306
+ versionRequirement :: VersionRange -> String
307
+ versionRequirement range
308
+ | isAnyVersion range = " "
309
+ | otherwise = " version " ++ prettyShow range
252
310
253
311
exceptionMessage :: CabalException -> String
254
312
exceptionMessage e = case e of
@@ -538,17 +596,17 @@ exceptionMessage e = case e of
538
596
HowToFindInstalledPackages flv ->
539
597
" don't know how to find the installed packages for "
540
598
++ prettyShow flv
541
- PkgConfigNotFound pkg versionRequirement ->
599
+ PkgConfigNotFound pkg versionReq ->
542
600
" The pkg-config package '"
543
601
++ pkg
544
602
++ " '"
545
- ++ versionRequirement
603
+ ++ versionReq
546
604
++ " is required but it could not be found."
547
- BadVersion pkg versionRequirement v ->
605
+ BadVersion pkg versionReq v ->
548
606
" The pkg-config package '"
549
607
++ pkg
550
608
++ " '"
551
- ++ versionRequirement
609
+ ++ versionReq
552
610
++ " is required but the version installed on the"
553
611
++ " system is version "
554
612
++ prettyShow v
@@ -645,3 +703,92 @@ exceptionMessage e = case e of
645
703
text " The following package dependencies were requested"
646
704
$+$ nest 4 dispDepend
647
705
$+$ text " however the given installed package instance does not exist."
706
+ CantParseGHCOutput -> " Can't parse --info output of GHC"
707
+ IncompatibleWithCabal compilerName packagePathEnvVar ->
708
+ " Use of "
709
+ ++ compilerName
710
+ ++ " 's environment variable "
711
+ ++ packagePathEnvVar
712
+ ++ " is incompatible with Cabal. Use the "
713
+ ++ " flag --package-db to specify a package database (it can be "
714
+ ++ " used multiple times)."
715
+ Couldn'tFindTestProgram cmd ->
716
+ " Could not find test program \" "
717
+ ++ cmd
718
+ ++ " \" . Did you build the package first?"
719
+ TestCoverageSupport -> " Test coverage is only supported for packages with a library component."
720
+ Couldn'tFindTestProgLibV09 cmd ->
721
+ " Could not find test program \" "
722
+ ++ cmd
723
+ ++ " \" . Did you build the package first?"
724
+ TestCoverageSupportLibV09 -> " Test coverage is only supported for packages with a library component."
725
+ RawSystemStdout errors -> errors
726
+ FindFileCwd fileName -> fileName ++ " doesn't exist"
727
+ FindFileEx fileName -> fileName ++ " doesn't exist"
728
+ FindModuleFileEx mod_name extensions searchPath ->
729
+ " Could not find module: "
730
+ ++ prettyShow mod_name
731
+ ++ " with any suffix: "
732
+ ++ show extensions
733
+ ++ " in the search path: "
734
+ ++ show searchPath
735
+ MultipleFilesWithExtension buildInfoExt -> " Multiple files with extension " ++ buildInfoExt
736
+ NoDesc ->
737
+ " No cabal file found.\n "
738
+ ++ " Please create a package description file <pkgname>.cabal"
739
+ MultiDesc l ->
740
+ " Multiple cabal files found.\n "
741
+ ++ " Please use only one of: "
742
+ ++ intercalate " , " l
743
+ RelocRegistrationInfo ->
744
+ " Distribution.Simple.Register.relocRegistrationInfo: \
745
+ \not implemented for this compiler"
746
+ CreatePackageDB ->
747
+ " Distribution.Simple.Register.createPackageDB: "
748
+ ++ " not implemented for this compiler"
749
+ WithHcPkg name ->
750
+ " Distribution.Simple.Register."
751
+ ++ name
752
+ ++ " :\
753
+ \not implemented for this compiler"
754
+ RegisMultiplePkgNotSupported -> " Registering multiple package instances is not yet supported for this compiler"
755
+ RegisteringNotImplemented -> " Registering is not implemented for this compiler"
756
+ NoTestSuitesEnabled ->
757
+ " No test suites enabled. Did you remember to configure with "
758
+ ++ " \' --enable-tests\' ?"
759
+ TestNameDisabled tName ->
760
+ " Package configured with test suite "
761
+ ++ tName
762
+ ++ " disabled."
763
+ NoSuchTest tName -> " no such test: " ++ tName
764
+ ConfigureProgram name path ->
765
+ " Cannot find the program '"
766
+ ++ name
767
+ ++ " '. User-specified path '"
768
+ ++ path
769
+ ++ " ' does not refer to an executable and "
770
+ ++ " the program is not on the system path."
771
+ RequireProgram progName -> " The program '" ++ progName ++ " ' is required but it could not be found."
772
+ NoProgramFound progName versionRange ->
773
+ " The program '"
774
+ ++ progName
775
+ ++ " '"
776
+ ++ versionRequirement versionRange
777
+ ++ " is required but it could not be found."
778
+ BadVersionDb progName version range locationPath ->
779
+ " The program '"
780
+ ++ progName
781
+ ++ " '"
782
+ ++ versionRequirement range
783
+ ++ " is required but the version found at "
784
+ ++ locationPath
785
+ ++ " is version "
786
+ ++ prettyShow version
787
+ UnknownVersionDb progName versionRange locationPath ->
788
+ " The program '"
789
+ ++ progName
790
+ ++ " '"
791
+ ++ versionRequirement versionRange
792
+ ++ " is required but the version of "
793
+ ++ locationPath
794
+ ++ " could not be determined."
0 commit comments