Skip to content

Commit e247c21

Browse files
committed
Merge pull request #1305 from 23Skidoo/sdist-list-sources
Create source archives by running 'setup sdist --output-directory'.
2 parents 4bcf6ad + 300f61d commit e247c21

File tree

8 files changed

+347
-303
lines changed

8 files changed

+347
-303
lines changed

Cabal/Distribution/Simple/Haddock.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo
9191
import Distribution.InstalledPackageInfo
9292
( InstalledPackageInfo )
9393
import Distribution.Simple.Utils
94-
( die, warn, notice, intercalate, setupMessage
94+
( die, copyFileTo, warn, notice, intercalate, setupMessage
9595
, createDirectoryIfMissingVerbose, withTempFile, copyFileVerbose
9696
, withTempDirectory, matchFileGlob
9797
, findFileWithExtension, findFile )
@@ -112,7 +112,6 @@ import System.FilePath((</>), (<.>), splitFileName, splitExtension,
112112
normalise, splitPath, joinPath )
113113
import System.IO (hClose, hPutStrLn)
114114
import Distribution.Version
115-
import Distribution.Simple.SrcDist (copyFileTo)
116115

117116
-- Types
118117

Cabal/Distribution/Simple/Setup.hs

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -792,19 +792,21 @@ instance Monoid InstallFlags where
792792

793793
-- | Flags to @sdist@: (snapshot, verbosity)
794794
data SDistFlags = SDistFlags {
795-
sDistSnapshot :: Flag Bool,
796-
sDistDirectory :: Flag FilePath,
797-
sDistDistPref :: Flag FilePath,
798-
sDistVerbosity :: Flag Verbosity
795+
sDistSnapshot :: Flag Bool,
796+
sDistDirectory :: Flag FilePath,
797+
sDistDistPref :: Flag FilePath,
798+
sDistListSources :: Flag FilePath,
799+
sDistVerbosity :: Flag Verbosity
799800
}
800801
deriving Show
801802

802803
defaultSDistFlags :: SDistFlags
803804
defaultSDistFlags = SDistFlags {
804-
sDistSnapshot = Flag False,
805-
sDistDirectory = mempty,
806-
sDistDistPref = Flag defaultDistPref,
807-
sDistVerbosity = Flag normal
805+
sDistSnapshot = Flag False,
806+
sDistDirectory = mempty,
807+
sDistDistPref = Flag defaultDistPref,
808+
sDistListSources = mempty,
809+
sDistVerbosity = Flag normal
808810
}
809811

810812
sdistCommand :: CommandUI SDistFlags
@@ -819,13 +821,19 @@ sdistCommand = makeCommand name shortDesc longDesc defaultSDistFlags options
819821
sDistDistPref (\d flags -> flags { sDistDistPref = d })
820822
showOrParseArgs
821823

824+
,option "" ["list-sources"]
825+
"Just write a list of the package's sources to a file"
826+
sDistListSources (\v flags -> flags { sDistListSources = v })
827+
(reqArgFlag "FILE")
828+
822829
,option "" ["snapshot"]
823830
"Produce a snapshot source distribution"
824831
sDistSnapshot (\v flags -> flags { sDistSnapshot = v })
825832
trueArg
826833

827834
,option "" ["output-directory"]
828-
"Generate a source distribution in the given directory"
835+
("Generate a source distribution in the given directory, "
836+
++ "without creating a tarball")
829837
sDistDirectory (\v flags -> flags { sDistDirectory = v })
830838
(reqArgFlag "DIR")
831839
]
@@ -835,16 +843,18 @@ emptySDistFlags = mempty
835843

836844
instance Monoid SDistFlags where
837845
mempty = SDistFlags {
838-
sDistSnapshot = mempty,
839-
sDistDirectory = mempty,
840-
sDistDistPref = mempty,
841-
sDistVerbosity = mempty
846+
sDistSnapshot = mempty,
847+
sDistDirectory = mempty,
848+
sDistDistPref = mempty,
849+
sDistListSources = mempty,
850+
sDistVerbosity = mempty
842851
}
843852
mappend a b = SDistFlags {
844-
sDistSnapshot = combine sDistSnapshot,
845-
sDistDirectory = combine sDistDirectory,
846-
sDistDistPref = combine sDistDistPref,
847-
sDistVerbosity = combine sDistVerbosity
853+
sDistSnapshot = combine sDistSnapshot,
854+
sDistDirectory = combine sDistDirectory,
855+
sDistDistPref = combine sDistDistPref,
856+
sDistListSources = combine sDistListSources,
857+
sDistVerbosity = combine sDistVerbosity
848858
}
849859
where combine field = field a `mappend` field b
850860

0 commit comments

Comments
 (0)