Commit cf5d5705 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Remove programatica support

I doubt it works or that anyone uses it.
If anyone genuinely does use it we can add it back in cabal-install.
parent 32847200
......@@ -39,8 +39,6 @@
-- [UnregisterCmd] We assume there is an @unregister@ target.
--
-- [HaddockCmd] We assume there is a @docs@ or @doc@ target.
--
-- [ProgramaticaCmd] We assume there is a @programatica@ target.
-- copy :
......@@ -145,7 +143,6 @@ defaultMainHelper args =
,sdistCommand `commandAddAction` sdistAction
,registerCommand `commandAddAction` registerAction
,unregisterCommand `commandAddAction` unregisterAction
,programaticaCommand `commandAddAction` programaticaAction
]
configureAction :: ConfigFlags -> [String] -> IO ()
......@@ -204,11 +201,6 @@ unregisterAction flags args = do
no_extra_flags args
rawSystemExit (fromFlag $ regVerbose flags) "make" ["unregister"]
programaticaAction :: PFEFlags -> [String] -> IO ()
programaticaAction flags args = do
no_extra_flags args
rawSystemExit (fromFlag $ pfeVerbose flags) "make" ["programatica"]
no_extra_flags :: [String] -> IO ()
no_extra_flags [] = return ()
no_extra_flags extra_flags =
......
......@@ -72,9 +72,8 @@ import Distribution.Package --must not specify imports, since we're exporting mo
import Distribution.PackageDescription
import Distribution.Simple.Program
( ProgramConfiguration, defaultProgramConfiguration, addKnownProgram
, userSpecifyArgs, pfesetupProgram, rawSystemProgramConf )
import Distribution.Simple.PreProcess (knownSuffixHandlers,
preprocessSources, PPSuffixHandler)
, userSpecifyArgs )
import Distribution.Simple.PreProcess (knownSuffixHandlers, PPSuffixHandler)
import Distribution.Simple.Setup
import Distribution.Simple.Command
......@@ -94,7 +93,7 @@ import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..), distPref, srcPre
import Distribution.Simple.Install (install)
import Distribution.Simple.Haddock (haddock, hscolour)
import Distribution.Simple.Utils
(die, notice, info, warn, chattyTry, moduleToFilePath,
(die, notice, info, warn, chattyTry,
defaultPackageDesc, defaultHookedPackageDesc,
rawSystemExit)
import Distribution.Verbosity
......@@ -108,7 +107,7 @@ import System.Directory(removeFile, doesFileExist,
doesDirectoryExist, removeDirectoryRecursive)
import System.Exit
import Control.Monad (when, unless)
import Control.Monad (when)
import Data.List (intersperse, unionBy)
-- | A simple implementation of @main@ for a Cabal setup script.
......@@ -176,7 +175,6 @@ defaultMainHelper hooks args =
,registerCommand `commandAddAction` registerAction hooks
,unregisterCommand `commandAddAction` unregisterAction hooks
,testCommand `commandAddAction` testAction hooks
,programaticaCommand `commandAddAction` programaticaAction hooks
,makefileCommand `commandAddAction` makefileAction hooks
]
......@@ -254,10 +252,6 @@ haddockAction :: UserHooks -> HaddockFlags -> Args -> IO ()
haddockAction = hookedAction preHaddock haddockHook postHaddock
getBuildConfigIfUpToDate
programaticaAction :: UserHooks -> PFEFlags -> Args -> IO ()
programaticaAction = hookedAction prePFE pfeHook postPFE
getBuildConfigIfUpToDate
cleanAction :: UserHooks -> CleanFlags -> Args -> IO ()
cleanAction hooks flags args = do
pbi <- preClean hooks args flags
......@@ -326,13 +320,6 @@ hookedAction pre_hook cmd_hook post_hook get_build_config hooks flags args = do
cmd_hook hooks pkg_descr localbuildinfo hooks flags
post_hook hooks args flags pkg_descr localbuildinfo
--TODO: where to put this? it's duplicated in .Haddock too
getModulePaths :: LocalBuildInfo -> BuildInfo -> [String] -> IO [FilePath]
getModulePaths lbi bi =
fmap concat .
mapM (flip (moduleToFilePath (buildDir lbi : hsSourceDirs bi)) ["hs", "lhs"])
getBuildConfigIfUpToDate :: IO LocalBuildInfo
getBuildConfigIfUpToDate = do
lbi <- getPersistBuildConfig
......@@ -341,24 +328,6 @@ getBuildConfigIfUpToDate = do
Just pkg_descr_file -> checkPersistBuildConfig pkg_descr_file
return lbi
-- --------------------------------------------------------------------------
-- Programmatica support
pfe :: PackageDescription -> [PPSuffixHandler] -> PFEFlags -> IO ()
pfe pkg_descr pps flags = do
unless (hasLibs pkg_descr) $
die "no libraries found in this project"
withLib pkg_descr () $ \lib -> do
lbi <- getPersistBuildConfig
let bi = libBuildInfo lib
let mods = exposedModules lib ++ otherModules (libBuildInfo lib)
preprocessSources pkg_descr lbi False verbosity pps
inFiles <- getModulePaths lbi bi mods
let verbFlags = if verbosity >= deafening then ["-v"] else []
rawSystemProgramConf verbosity pfesetupProgram (withPrograms lbi)
("noplogic" : "cpp" : verbFlags ++ inFiles)
where verbosity = fromFlag (pfeVerbose flags)
-- --------------------------------------------------------------------------
-- Cleaning
......@@ -415,7 +384,6 @@ simpleUserHooks =
copyHook = \desc lbi _ f -> install desc lbi f, -- has correct 'copy' behavior with params
instHook = defaultInstallHook,
sDistHook = \p l h f -> sdist p l f srcPref distPref (allSuffixHandlers h),
pfeHook = \p _ h f -> pfe p (allSuffixHandlers h) f,
cleanHook = \p _ _ f -> clean p f,
hscolourHook = \p l h f -> hscolour p l (allSuffixHandlers h) f,
haddockHook = \p l h f -> haddock p l (allSuffixHandlers h) f,
......
......@@ -79,7 +79,6 @@ module Distribution.Simple.Program (
, ldProgram
, tarProgram
, cppProgram
, pfesetupProgram
, pkgConfigProgram
) where
......@@ -466,7 +465,6 @@ builtinPrograms =
, c2hsProgram
, cpphsProgram
, greencardProgram
, pfesetupProgram
-- platform toolchain
, ranlibProgram
, arProgram
......@@ -628,9 +626,6 @@ tarProgram = simpleProgram "tar"
cppProgram :: Program
cppProgram = simpleProgram "cpp"
pfesetupProgram :: Program
pfesetupProgram = simpleProgram "pfesetup"
pkgConfigProgram :: Program
pkgConfigProgram = (simpleProgram "pkg-config") {
programFindVersion = findProgramVersion "--version" id
......
......@@ -52,7 +52,6 @@ module Distribution.Simple.Setup (
HscolourFlags(..), emptyHscolourFlags, defaultHscolourFlags, hscolourCommand,
BuildFlags(..), emptyBuildFlags, defaultBuildFlags, buildCommand,
CleanFlags(..), emptyCleanFlags, defaultCleanFlags, cleanCommand,
PFEFlags(..), emptyPFEFlags, defaultPFEFlags, programaticaCommand,
MakefileFlags(..), emptyMakefileFlags, defaultMakefileFlags, makefileCommand,
RegisterFlags(..), emptyRegisterFlags, defaultRegisterFlags, registerCommand,
unregisterCommand,
......@@ -1053,42 +1052,6 @@ instance Monoid MakefileFlags where
}
where combine field = field a `mappend` field b
-- ------------------------------------------------------------
-- * Programatica flags
-- ------------------------------------------------------------
data PFEFlags = PFEFlags {
pfeVerbose :: Flag Verbosity
}
deriving Show
defaultPFEFlags :: PFEFlags
defaultPFEFlags = PFEFlags {
pfeVerbose = Flag normal
}
programaticaCommand :: CommandUI PFEFlags
programaticaCommand = makeCommand name shortDesc longDesc defaultPFEFlags options
where
name = "pfe"
shortDesc = "Generate Programatica Project."
longDesc = Nothing
options _ =
[optionVerbose pfeVerbose (\v flags -> flags { pfeVerbose = v })
]
emptyPFEFlags :: PFEFlags
emptyPFEFlags = mempty
instance Monoid PFEFlags where
mempty = PFEFlags {
pfeVerbose = mempty
}
mappend a b = PFEFlags {
pfeVerbose = combine pfeVerbose
}
where combine field = field a `mappend` field b
-- ------------------------------------------------------------
-- * Test flags
-- ------------------------------------------------------------
......
......@@ -59,7 +59,7 @@ import Distribution.Simple.PreProcess (PPSuffixHandler)
import Distribution.Simple.Setup
(ConfigFlags, BuildFlags, MakefileFlags, CleanFlags, CopyFlags,
InstallFlags, SDistFlags, RegisterFlags, HscolourFlags,
HaddockFlags, PFEFlags)
HaddockFlags)
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo)
import Distribution.Simple.Utils (die)
......@@ -140,14 +140,14 @@ data UserHooks = UserHooks {
-- |Hook to run before register command
preReg :: Args -> RegisterFlags -> IO HookedBuildInfo,
-- |Over-ride this hook to get different behavior during pfe.
-- |Over-ride this hook to get different behavior during registration.
regHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> RegisterFlags -> IO (),
-- |Hook to run after register command
postReg :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO (),
-- |Hook to run before unregister command
preUnreg :: Args -> RegisterFlags -> IO HookedBuildInfo,
-- |Over-ride this hook to get different behavior during pfe.
-- |Over-ride this hook to get different behavior during registration.
unregHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> RegisterFlags -> IO (),
-- |Hook to run after unregister command
postUnreg :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO (),
......@@ -164,15 +164,7 @@ data UserHooks = UserHooks {
-- |Over-ride this hook to get different behavior during haddock.
haddockHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> HaddockFlags -> IO (),
-- |Hook to run after haddock command. Second arg indicates verbosity level.
postHaddock :: Args -> HaddockFlags -> PackageDescription -> LocalBuildInfo -> IO (),
-- |Hook to run before pfe command. Second arg indicates verbosity level.
prePFE :: Args -> PFEFlags -> IO HookedBuildInfo,
-- |Over-ride this hook to get different behavior during pfe.
pfeHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> PFEFlags -> IO (),
-- |Hook to run after pfe command. Second arg indicates verbosity level.
postPFE :: Args -> PFEFlags -> PackageDescription -> LocalBuildInfo -> IO ()
postHaddock :: Args -> HaddockFlags -> PackageDescription -> LocalBuildInfo -> IO ()
}
-- |Empty 'UserHooks' which do nothing.
......@@ -210,9 +202,6 @@ emptyUserHooks
preUnreg = rn,
unregHook = ru,
postUnreg = ru,
prePFE = rn,
pfeHook = ru,
postPFE = ru,
preHscolour = rn,
hscolourHook = ru,
postHscolour = ru,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment