Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Data-Files cabal directive should support directories #713

Open
bos opened this Issue · 9 comments

6 participants

@bos
Owner

(Imported from Trac #722, reported by cygnus on 2010-08-02)

It should be possible to use the Data-Files directive to include whole directories (recursively) in source distributions. In many cases it's impossible or cumbersome to list all of the files one would like to install, and it seems to me that nobody should have to do that if what they really mean is, "install everything in that-data-dir/."

In implementation terms, this doesn't strike me as too tricky; after the wildcard parsing that already happens, detect whether the files to be copied are in fact directories and copy them recursively as such.

I'm more than willing to hack on this.

@bos
Owner

(Imported comment by @dcoutts on 2010-08-02)

I think we should discuss this with users a bit first. The point of the existing rather limited support for globbing is to avoid accidentally picking up more files than was intended (e.g. hidden or generated files). By limiting it to files with a common extension this risk is greatly reduced. Perhaps we could make it explicit by only doing recursive copy for directories that are listed in the data-files field with a trailing directory slash, e.g. data-files: graphics/

@bos
Owner

(Imported comment by @ezyang on 2010-08-09)

I will note, for whatever it's worth, that this design policy has lead me to write scripts that do regular style globbing and convert it into something I can place in my Cabal file. :-)

@bos
Owner

(Imported comment by cygnus on 2010-08-09)

I would support a trailing slash option.

@bos
Owner

(Imported comment by @dcoutts on 2010-08-10)

See also #794.

@hdgarrood

I think the issue IDs were rearranged -- #794 doesn't seem to be relevant to this issue. #784 is, however.

@23Skidoo
Collaborator

@hdgarrood Yes, @dcoutts refers to http://hackage.haskell.org/trac/hackage/ticket/794 . Cross-references got mixed up during the trac -> github import.

@hdgarrood hdgarrood referenced this issue from a commit in hdgarrood/cabal
@hdgarrood hdgarrood Allow directories in cabal data-files (#713)
This commit adds the capability to specify a whole directory which
contains data-files in a project's .cabal file.

If a data-files entry ends with a slash, like "static/", then it will
pull in all files under the directory named "static/".

Notes:

* This has only been tested by calling matchDirFileGlob in GHCi.
* I'm not sure about the name (data FileGlob = DirTrailingSlash --
  perhaps it should have Glob on the end like the others?) but I've been
  unable to come up with anything better.
8147d0b
@23Skidoo 23Skidoo modified the milestone: Cabal-1.22, Cabal-1.18
@mietek

Having data-files: static/*.foo not glob static/*.bar.foo is rather surprising. A documented gotcha is still a gotcha.

I would support using a standard globbing mechanism in place of the current one, which also seems to have some odd corner cases. (#2030)

@mietek

Halcyon supports declaring additional data-files for use at run-time with the HALCYON_EXTRA_DATA_FILES option, using standard GNU bash globbing syntax.

See Haskell Language for an example of declaring static website content as data files.

@mietek mietek referenced this issue in mietek/halcyon
Open

Add and improve glob-based options #39

0 of 2 tasks complete
@ttuegel ttuegel modified the milestone: Cabal-1.24, Cabal-1.22
@BardurArantsson

Tihs is either superceded by (or supercedes) #784 . Can we please close one of them?

EDIT: Actually, it's superceded. Glob syntax allows for directories (recursively) via "foo/*/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.