From 5f36de89409574c5f3f2ea5125cfab331976aa06 Mon Sep 17 00:00:00 2001 From: hololeap Date: Wed, 21 Jan 2026 01:34:01 -0700 Subject: [PATCH 1/1] Migrate to cabal-doctest doctest pulls in the out-of-scope packages if they are installed on the system. The best workaround is to use migrate to cabal-doctest. Bug: https://github.com/gentoo-haskell/gentoo-haskell/issues/1231 Signed-off-by: hololeap --- /dev/null +++ b/Setup.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE CPP #-} + +module Main (main) where + +#ifndef MIN_VERSION_cabal_doctest +#define MIN_VERSION_cabal_doctest(x,y,z) 0 +#endif + +#if MIN_VERSION_cabal_doctest(1,0,0) + +import Distribution.Extra.Doctest ( defaultMainWithDoctests ) + +main :: IO () +main = defaultMainWithDoctests "mwc-doctests" + +#else + +import Distribution.Simple + +main :: IO () +main = defaultMain + +#endif --- a/Setup.lhs +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env runhaskell -> import Distribution.Simple -> main = defaultMain --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -1,5 +1,5 @@ cabal-version: 3.0 -build-type: Simple +build-type: Custom name: mwc-random version: 0.15.3.0 license: BSD-2-Clause @@ -61,6 +61,11 @@ flag BenchPAPI Default: False Manual: True +custom-setup + setup-depends: + base + , cabal-doctest >=1.0.9 && <1.1 + library default-language: Haskell2010 exposed-modules: System.Random.MWC @@ -141,7 +146,6 @@ test-suite mwc-doctests buildable: False build-depends: base -any - , mwc-random -any , doctest >=0.15 && <0.24 -- , bytestring --- a/tests/doctests.hs +++ b/tests/doctests.hs @@ -1,4 +1,9 @@ +import Build_doctests (flags, pkgs, module_sources) import Test.DocTest (doctest) +import GHC.IO.Encoding (setLocaleEncoding) +import System.IO (utf8) main :: IO () -main = doctest ["-fobject-code", "System/Random/MWC.hs"] +main = do + setLocaleEncoding utf8 + doctest $ flags ++ pkgs ++ module_sources -- 2.52.0