Commit b1c53af6 authored by ijones's avatar ijones
Browse files

used new "removedPreprocessed" function in sdist

parent 5b9fc9af
......@@ -52,6 +52,7 @@ module Distribution.Package (
emptyBuildInfo,
Executable(..),
emptyExecutable,
allModules,
#ifdef DEBUG
hunitTests,
test
......@@ -116,6 +117,12 @@ emptyPackageDescription
executables = []
}
-- |Get all the module names from this package
allModules :: PackageDescription -> [String]
allModules PackageDescription{executables=execs, library=lib}
= (concat $ map (\e -> modules $ buildInfo e) execs)
++ (maybe [] modules lib)
-- |Set the name for this package. Convenience function.
setPkgName :: String -> PackageDescription -> PackageDescription
setPkgName n desc@PackageDescription{package=pkgIdent}
......
......@@ -38,7 +38,8 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.PreProcess (preprocessSources, knownSuffixHandlers,
ppSuffixes, PPSuffixHandler, PreProcessor)
ppSuffixes, PPSuffixHandler, PreProcessor,
removePreprocessed)
where
import Distribution.PreProcess.Unlit(plain, unlit)
......@@ -132,8 +133,6 @@ removePreprocessed searchLoc mods suffixesIn
when (length hsFiles > 1)
(putStrLn "Internal Error: multiple \".hs\" files found while removing preprocessed element."
>> exitWith (ExitFailure 1))
putStrLn $ show hsFiles
putStrLn $ show l
removeFiles hsFiles
return ()
-- the files in this list only differ by their extension
......
......@@ -56,6 +56,7 @@ module Distribution.Simple (
-- local
import Distribution.Package --must not specify imports, since we're exporting moule.
import Distribution.PreProcess (knownSuffixHandlers)
import Distribution.Setup
import Distribution.Simple.Build ( build )
......@@ -140,7 +141,7 @@ defaultMainNoRead pkg_descr
(_, args) <- parseSDistArgs args []
no_extra_flags args
localbuildinfo <- getPersistBuildConfig
sdist srcPref distPref [] pkg_descr localbuildinfo
sdist srcPref distPref knownSuffixHandlers pkg_descr localbuildinfo
RegisterCmd uInst -> do
(uInst, _, args) <- parseRegisterArgs uInst args []
......
......@@ -40,6 +40,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
-- NOTE: FIX: we don't have a great way of testing this module, since
-- we can't easily look inside a tarball once its created.
module Distribution.Simple.SrcDist (
sdist
#ifdef DEBUG
......@@ -47,10 +50,10 @@ module Distribution.Simple.SrcDist (
#endif
) where
import Distribution.Package(PackageDescription(..), BuildInfo(..), showPackageId)
import Distribution.Package(PackageDescription(..), BuildInfo(..), showPackageId, allModules)
import Distribution.Simple.Configure(LocalBuildInfo)
import Distribution.Simple.Utils(setupMessage, moveSources, die, pathJoin)
import Distribution.PreProcess (PPSuffixHandler, ppSuffixes, knownSuffixHandlers)
import Distribution.PreProcess (PPSuffixHandler, ppSuffixes, knownSuffixHandlers, removePreprocessed)
import Control.Monad(when)
import System.Cmd (system)
......@@ -73,9 +76,13 @@ sdist tmpDir targetPref pps pkg_descr _ = do
case library pkg_descr of
Just lib -> let srcDir = hsSourceDir lib
tmpLoc1 = pathJoin [tmpDir, nameVersion pkg_descr, srcDir]
in moveSources srcDir tmpLoc1 (modules lib)
(ppSuffixes (knownSuffixHandlers ++ pps))
in do moveSources srcDir tmpLoc1 (modules lib)
(ppSuffixes (knownSuffixHandlers ++ pps))
removePreprocessed tmpLoc1 (modules lib) (ppSuffixes pps)
Nothing -> return ()
-- FIX: move executables!
-- removePreprocessed tmpLoc1 (allModules pkg_descr) (ppSuffixes pps) (for execs)
let tmpLoc2 = pathJoin [tmpDir, nameVersion pkg_descr]
moveSources "" tmpLoc2 ["Setup"] ["lhs", "hs"]
system $ "tar --directory=" ++ tmpDir ++ " -zcf " ++
......
** make sure we have consistent behavior, either we pass in the
knownPreprocessors or we require the user to pass them in...
** bug in srcDist where it doesn't move exe sources into place
** integrate w/ GHC distro
** Preprocessing
- what other preprocessors can't unlit?
......
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