-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from haskell/fix-sdist
Fix sdist
- Loading branch information
Showing
10 changed files
with
62 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Control.Monad | ||
import Data.Foldable | ||
import System.FilePath | ||
import System.Directory | ||
import System.Process | ||
import System.Exit | ||
|
||
main :: IO () | ||
main = do | ||
let bootstrap_root = "./bootstrap-root" | ||
happy_boot = bootstrap_root </> "happy" | ||
callProcess "cabal" | ||
[ "install", "happy", | ||
"-f", "-bootstrap", | ||
"--installdir=" ++ bootstrap_root ] | ||
with_y_files "packages" $ \y_file -> do | ||
putStrLn $ "Processing " ++ show y_file | ||
callProcess happy_boot [y_file] | ||
removeFile y_file | ||
removePathForcibly bootstrap_root | ||
|
||
with_y_files :: FilePath -> (FilePath -> IO ()) -> IO () | ||
with_y_files path cont = do | ||
is_dir <- doesDirectoryExist path | ||
if is_dir then do | ||
entries <- listDirectory path | ||
for_ entries $ \entry -> | ||
with_y_files (path </> entry) cont | ||
else do | ||
is_file <- doesFileExist path | ||
if is_file then do | ||
let ext = takeExtension path | ||
when (ext == ".y" || ext == ".ly") (cont path) | ||
else do | ||
die ("Neither file nor dir: " ++ show path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters