Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,9 @@ checkSetupExists _ =
( \ops -> do
ba <- doesFileExist ops "Setup.hs"
bb <- doesFileExist ops "Setup.lhs"
return (not $ ba || bb)
bc <- doesFileExist ops "SetupHooks.hs"
bd <- doesFileExist ops "SetupHooks.lhs"
return (not $ ba || bb || bc || bd)
)
(PackageDistInexcusable MissingSetupFile)

Expand Down
3 changes: 2 additions & 1 deletion Cabal/src/Distribution/PackageDescription/Check/Warning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,8 @@ ppExplanation (UnknownFile fieldname file) =
++ quote (getSymbolicPath file)
++ " which does not exist."
ppExplanation MissingSetupFile =
"The package is missing a Setup.hs or Setup.lhs script."
"The package is missing a Setup.hs or Setup.lhs or SetupHooks.hs "
++ "or SetupHooks.lhs script."
ppExplanation MissingConfigureScript =
"The 'build-type' is 'Configure' but there is no 'configure' script. "
++ "You probably need to run 'autoreconf -i' to generate it."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cabal check
The following errors will cause portability problems on other environments:
Error: [missing-setup] The package is missing a Setup.hs or Setup.lhs script.
Error: [missing-setup] The package is missing a Setup.hs or Setup.lhs or
SetupHooks.hs or SetupHooks.lhs script.
Error: Hackage would reject this package.
6 changes: 6 additions & 0 deletions cabal-testsuite/PackageTests/Check/SetupHooks/SetupHooks.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module SetupHooks where

import Distribution.Simple.SetupHooks ( SetupHooks, noSetupHooks )

setupHooks :: SetupHooks
setupHooks = noSetupHooks
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Check/SetupHooks/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# cabal check
No errors or warnings could be found in the package.
5 changes: 5 additions & 0 deletions cabal-testsuite/PackageTests/Check/SetupHooks/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

-- SetupHooks.hs is a valid setup script.
main = cabalTest $
cabal "check" []
24 changes: 24 additions & 0 deletions cabal-testsuite/PackageTests/Check/SetupHooks/pkg.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cabal-version: 3.14
name: pkg
version: 0.1.0.0
synopsis: pkg
description: pkg description
license: GPL-3.0-or-later
author: Joris Dral
maintainer: [email protected]
build-type: Hooks
category: Data

common warnings
ghc-options: -Wall

library
import: warnings
exposed-modules: MyLib
build-depends: base ^>=4.18.3.0
default-language: Haskell2010

custom-setup
setup-depends:
Cabal-hooks >=3.14 && <3.17,
base >=4.18 && <5
8 changes: 8 additions & 0 deletions changelog.d/pr-11351
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
synopsis: Recognise SetupHooks.hs
packages: [cabal-install]
prs: 11351
issues: 11349
---

`cabal check` now recogsnises `SetupHooks.hs` as a valid setup script.
2 changes: 1 addition & 1 deletion doc/cabal-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ A list of all warnings with their constructor:
- ``no-cabal-file``: no ``.cabal`` file found in folder.
- ``multiple-cabal-file``: multiple ``.cabal`` files found in folder.
- ``unknown-file``: path refers to a file which does not exist.
- ``missing-setup``: missing ``Setup.hs`` or ``Setup.lsh``.
- ``missing-setup``: missing ``Setup.hs`` or ``Setup.lhs`` or ``SetupHooks.hs`` or ``SetupHooks.lhs``.
- ``missing-conf-script``: missing ``configure`` script with ``build-type: Configure``.
- ``unknown-directory``: paths refer to a directory which does not exist.
- ``no-repository``: missing ``source-repository`` section.
Expand Down
Loading