@@ -54,6 +54,7 @@ import Distribution.System
54
54
import Distribution.Types.ComponentRequestedSpec
55
55
import Distribution.Types.CondTree
56
56
import Distribution.Types.ExeDependency
57
+ import Distribution.Types.LibraryName
57
58
import Distribution.Types.UnqualComponentName
58
59
import Distribution.Utils.Generic (isAscii )
59
60
import Distribution.Verbosity
@@ -195,7 +196,7 @@ checkSanity pkg =
195
196
PackageBuildImpossible
196
197
" No executables, libraries, tests, or benchmarks found. Nothing to do."
197
198
198
- , check (any isNothing (map libName $ subLibraries pkg)) $
199
+ , check (any ( == LMainLibName ) (map libName $ subLibraries pkg)) $
199
200
PackageBuildImpossible $ " Found one or more unnamed internal libraries. "
200
201
++ " Only the non-internal library can have the same name as the package."
201
202
@@ -236,7 +237,7 @@ checkSanity pkg =
236
237
-- The public 'library' gets special dispensation, because it
237
238
-- is common practice to export a library and name the executable
238
239
-- the same as the package.
239
- subLibNames = catMaybes . map libName $ subLibraries pkg
240
+ subLibNames = mapMaybe (libraryNameString . libName) $ subLibraries pkg
240
241
exeNames = map exeName $ executables pkg
241
242
testNames = map testName $ testSuites pkg
242
243
bmNames = map benchmarkName $ benchmarks pkg
@@ -254,10 +255,7 @@ checkLibrary pkg lib =
254
255
-- TODO: This check is bogus if a required-signature was passed through
255
256
, check (null (explicitLibModules lib) && null (reexportedModules lib)) $
256
257
PackageDistSuspiciousWarn $
257
- " Library " ++ (case libName lib of
258
- Nothing -> " "
259
- Just n -> prettyShow n
260
- ) ++ " does not expose any modules"
258
+ showLibraryName (libName lib) ++ " does not expose any modules"
261
259
262
260
-- check use of signatures sections
263
261
, checkVersion [1 ,25 ] (not (null (signatures lib))) $
@@ -589,7 +587,7 @@ checkFields pkg =
589
587
, isNoVersion vr ]
590
588
591
589
internalLibraries =
592
- map (maybe (packageName pkg) (unqualComponentNameToPackageName) . libName)
590
+ map (maybe (packageName pkg) (unqualComponentNameToPackageName) . libraryNameString . libName)
593
591
(allLibraries pkg)
594
592
595
593
internalExecutables = map exeName $ executables pkg
0 commit comments