cabal-doctest 1.0.6 → 1.0.7
raw patch · 4 files changed
+47/−21 lines, 4 filesdep ~Cabaldep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal, base
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- README.md +1/−1
- cabal-doctest.cabal +11/−4
- src/Distribution/Extra/Doctest.hs +30/−16
ChangeLog.md view
@@ -1,3 +1,8 @@+# 1.0.7 -- 2019-??-??++* Make `Distribution.Extra.Doctest` `-Wall`-clean+* Support GHC-8.8, base-4.13, and Cabal-3.0+ # 1.0.6 -- 2018-01-28 * Hook `haddock` build too. Fixes issue when `haddock` fails, as
README.md view
@@ -192,7 +192,7 @@ `defaultMainAutoconfWithDoctests` function to make custom `Setup.hs` script. * If you use the default `.` in `hs-source-dirs`, then running `doctests`- might fail with weird errors (ambigious module errors). Workaround is+ might fail with weird errors (ambiguous module errors). Workaround is to move sources under `src/` or some non-top-level directory. * `extensions:` field isn't supported. Upgrade your `.cabal` file to use at least
cabal-doctest.cabal view
@@ -1,5 +1,5 @@ name: cabal-doctest-version: 1.0.6+version: 1.0.7 synopsis: A Setup.hs helper for doctests running description: Currently (beginning of 2017), there isn't @cabal doctest@@@ -27,7 +27,10 @@ GHC==7.8.4, GHC==7.10.3, GHC==8.0.2,- GHC==8.2.2+ GHC==8.2.2,+ GHC==8.4.4,+ GHC==8.6.5,+ GHC==8.8.1 source-repository head type: git@@ -38,9 +41,13 @@ other-modules: other-extensions: build-depends:- base >=4.3 && <4.11,- Cabal >= 1.10 && <2.1,+ base >=4.3 && <4.14,+ Cabal >= 1.10 && <3.1, filepath, directory hs-source-dirs: src default-language: Haskell2010+ ghc-options: -Wall+ if !impl(ghc >= 7.2)+ -- Work around a pattern-match coverage checking bug in GHC 7.0+ ghc-options: -fno-warn-overlapping-patterns
src/Distribution/Extra/Doctest.hs view
@@ -56,10 +56,6 @@ (for_) import qualified Data.Traversable as T (traverse)-import qualified Distribution.ModuleName as ModuleName- (fromString)-import Distribution.ModuleName- (ModuleName) import Distribution.Package (InstalledPackageId) import Distribution.Package@@ -69,8 +65,6 @@ PackageDescription (), TestSuite (..)) import Distribution.Simple (UserHooks (..), autoconfUserHooks, defaultMainWithHooks, simpleUserHooks)-import Distribution.Simple.BuildPaths- (autogenModulesDir) import Distribution.Simple.Compiler (PackageDB (..), showCompilerId) import Distribution.Simple.LocalBuildInfo@@ -79,17 +73,19 @@ import Distribution.Simple.Setup (BuildFlags (buildDistPref, buildVerbosity), HaddockFlags (haddockDistPref, haddockVerbosity), fromFlag, emptyBuildFlags) import Distribution.Simple.Utils- (createDirectoryIfMissingVerbose, findFile, rewriteFile)+ (createDirectoryIfMissingVerbose, info) import Distribution.Text (display, simpleParse) import System.FilePath- ((</>), (<.>), dropExtension)+ ((</>)) import Data.IORef (newIORef, modifyIORef, readIORef) -#if MIN_VERSION_Cabal(1,25,0) import Distribution.Simple.BuildPaths+#if MIN_VERSION_Cabal(1,25,0) (autogenComponentModulesDir)+#else+ (autogenModulesDir) #endif #if MIN_VERSION_Cabal(2,0,0) import Distribution.Types.MungedPackageId@@ -104,6 +100,16 @@ (CondTree (..)) #endif +#if MIN_VERSION_Cabal(3,0,0)+import Distribution.Simple.Utils (findFileEx)+#else+import Distribution.Simple.Utils (findFile)+#endif++#if MIN_VERSION_Cabal(3,0,0)+import Distribution.Types.LibraryName (libraryNameString)+#endif+ #if MIN_VERSION_directory(1,2,2) import System.Directory (makeAbsolute)@@ -120,6 +126,11 @@ return $ cwd </> p #endif +#if !MIN_VERSION_Cabal(3,0,0)+findFileEx :: verbosity -> [FilePath] -> FilePath -> IO FilePath+findFileEx _ = findFile+#endif+ -- | A default main with doctests: -- -- @@@ -233,6 +244,7 @@ -- First, we create the autogen'd module Build_doctests. -- Initially populate Build_doctests with a simple preamble.+ info verbosity $ "cabal-doctest: writing Build_doctests to " ++ buildDoctestsFile writeFile buildDoctestsFile $ unlines [ "module Build_doctests where" , ""@@ -306,7 +318,7 @@ -- even though the main-is module is named Main, its filepath might -- actually be Something.hs. To account for this possibility, we simply -- pass the full path to the main-is module instead.- mainIsPath <- T.traverse (findFile iArgsNoPrefix) (compMainIs comp)+ mainIsPath <- T.traverse (findFileEx verbosity iArgsNoPrefix) (compMainIs comp) let all_sources = map display module_sources ++ additionalModules@@ -334,8 +346,8 @@ getBuildDoctests withExeLBI (NameExe . executableName) (const []) (Just . modulePath) buildInfo components <- readIORef componentsRef- F.for_ components $ \(Component name pkgs flags sources) -> do- let compSuffix = nameToString name+ F.for_ components $ \(Component cmpName cmpPkgs cmpFlags cmpSources) -> do+ let compSuffix = nameToString cmpName pkgs_comp = "pkgs" ++ compSuffix flags_comp = "flags" ++ compSuffix module_sources_comp = "module_sources" ++ compSuffix@@ -344,13 +356,13 @@ appendFile buildDoctestsFile $ unlines [ -- -package-id etc. flags pkgs_comp ++ " :: [String]"- , pkgs_comp ++ " = " ++ show pkgs+ , pkgs_comp ++ " = " ++ show cmpPkgs , "" , flags_comp ++ " :: [String]"- , flags_comp ++ " = " ++ show flags+ , flags_comp ++ " = " ++ show cmpFlags , "" , module_sources_comp ++ " :: [String]"- , module_sources_comp ++ " = " ++ show sources+ , module_sources_comp ++ " = " ++ show cmpSources , "" ] @@ -432,7 +444,9 @@ isSpecific _ = False mbLibraryName :: Library -> Name-#if MIN_VERSION_Cabal(2,0,0)+#if MIN_VERSION_Cabal(3,0,0)+ mbLibraryName = NameLib . fmap unUnqualComponentName . libraryNameString . libName+#elif MIN_VERSION_Cabal(2,0,0) -- Cabal-2.0 introduced internal libraries, which are named. mbLibraryName = NameLib . fmap unUnqualComponentName . libName #else