packages feed

buildwrapper 0.9.0 → 0.9.1

raw patch · 4 files changed

+8/−8 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

buildwrapper.cabal view
@@ -1,5 +1,5 @@ name:           buildwrapper-version:        0.9.0+version:        0.9.1 cabal-version:  >= 1.8 build-type:     Custom license:        BSD3
src/Language/Haskell/BuildWrapper/API.hs view
@@ -26,9 +26,6 @@ import Prelude hiding (readFile, writeFile)
 import qualified Data.Vector as V
 
---import System.IO.UTF8 hiding (readFile, writeFile)
---import Codec.Binary.UTF8.String
-
 import Control.Monad.State
 import Language.Haskell.Exts.Annotated hiding (String)
 import Language.Preprocessor.Cpphs
src/Language/Haskell/BuildWrapper/Base.hs view
@@ -35,9 +35,8 @@ import Data.List (isPrefixOf)
 import Data.Maybe (catMaybes)
 
-import System.IO.UTF8 (hPutStr,hGetContents)
 import           Data.ByteString.UTF8     (toString)
-import System.IO (IOMode, openBinaryFile, IOMode(..), Handle, hClose, hFlush, stdout)
+import System.IO (IOMode, openBinaryFile, IOMode(..), Handle, hClose, hFlush, stdout, hPutStr, hGetContents, hSetEncoding, utf8)
 import Control.DeepSeq (rnf, NFData) 
 -- | State type
@@ -801,13 +800,14 @@ -- readFile n=hGetContents =<< openBinaryFile n ReadMode
 readFile n =  do
         inFile<- openBinaryFile n ReadMode
+        hSetEncoding inFile utf8
         contents <- hGetContents inFile
         rnf contents `seq` hClose inFile -- force the whole file to be read, then close http://stackoverflow.com/a/297630/827593
         return contents
 
 -- | write string to file
 writeFile :: FilePath -> String -> IO ()
-writeFile n s = withBinaryFile n WriteMode (`hPutStr` s)      
+writeFile n s = withBinaryFile n WriteMode (\h -> hSetEncoding h utf8 >> h `hPutStr` s)      
 
 -- | perform operation on a binary opened file
 withBinaryFile :: FilePath -> IOMode -> (Handle -> IO a) -> IO a
src/Language/Haskell/BuildWrapper/Cabal.hs view
@@ -544,7 +544,10 @@ fileGhcOptions (CabalBuildInfo tgt _ isLib _ _)=do
         dist_dir<-getDistDir
         let inplace=dist_dir </> "package.conf.inplace"
-        inplaceExist<-liftIO $ doesFileExist inplace
+        inplaceExist<-liftIO $ do
+          f<-doesFileExist inplace
+          d<-doesDirectoryExist inplace -- in Cabal 1.22
+          return $ f || d
         n<-getPackageName
         let pkg
                   | isLib =