Noticed this when trying to cabal-dev install my stuff.

1 patch for repository http://code.haskell.org/wxhaskell:

Mon Apr 16 09:25:24 BST 2012  Eric Kow <eric....@gmail.com>
  * Try a little harder to find wxc install directory.
  
  Users of cabal-dev may find that the wxc include dir does not have
  wxc anywhere in its path, eg.
    /home/moi/my-package/cabal-dev//lib//include
  So instead we try looking for the wxc.h file itself.

[Try a little harder to find wxc install directory.
Eric Kow <eric....@gmail.com>**20120416082524
 Ignore-this: efb4de28fd7edd6d945344dbae84183
 
 Users of cabal-dev may find that the wxc include dir does not have
 wxc anywhere in its path, eg.
   /home/moi/my-package/cabal-dev//lib//include
 So instead we try looking for the wxc.h file itself.
] {
hunk ./wxcore/Setup.hs 1
-import Control.Monad (when)
+import Control.Monad (when, filterM)
 import Data.List (foldl', intersperse, intercalate, nub, lookup, isPrefixOf, isInfixOf, find)
 import Data.Maybe (fromJust)
 import Distribution.PackageDescription hiding (includeDirs)
hunk ./wxcore/Setup.hs 37
 -- It works by finding the wxc package's installation info, then finding the include directory 
 -- which contains wxc's headers (amongst the wxWidgets include dirs) and then going up a level.
 -- It would be nice the path was park of InstalledPackageInfo, but it isn't.
-wxcInstallDir :: LocalBuildInfo -> FilePath
+wxcInstallDir :: LocalBuildInfo -> IO FilePath
 wxcInstallDir lbi = 
     case searchByName (installedPkgs lbi) "wxc" of
hunk ./wxcore/Setup.hs 40
-        Unambiguous wxc_pkgs -> case find (isInfixOf "wxc") . includeDirs . head $ wxc_pkgs of
-            Just wxcIncludeDir -> takeDirectory wxcIncludeDir
-            Nothing -> error "wxcInstallDir: Couldn't find wxc include dir"
+        Unambiguous (wxc_pkg:_) -> do
+            wxc <- filterM (doesFileExist . (</> "wxc.h")) (includeDirs wxc_pkg)
+            case wxc of
+                [wxcIncludeDir] -> return (takeDirectory wxcIncludeDir)
+                [] -> error "wxcInstallDir: Couldn't find wxc include dir"
+                _  -> error "wxcInstallDir: I'm confused. I see more than one wxc include directory from the same package" 
+        Unambiguous [] -> error "wxcInstallDir: Cabal says wxc is installed, but gives no package info for it"
         _ -> error "wxcInstallDir: Couldn't find wxc package in installed packages"
 
 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
hunk ./wxcore/Setup.hs 56
     createDirectoryIfMissing True wxcoreDirectory
 
     lbi <- confHook simpleUserHooks (pkg0, pbi) flags
-    let wxcDirectory = wxcInstallDir lbi
-        wxcoreIncludeFile = wxcDirectory </> "include/wxc.h"
+    wxcDirectory <- wxcInstallDir lbi
+    let wxcoreIncludeFile = wxcDirectory </> "include/wxc.h"
 
     putStrLn "Generating class type definitions from .h files"
     system $ "wxdirect -t --wxc " ++ wxcDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
}

Attachment: try-a-little-harder-to-find-wxc-install-directory_.dpatch
Description: A darcs patch for your repository!

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
wxhaskell-devel mailing list
wxhaskell-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel

Reply via email to