rejeep/carton — pull request #22 by lunaryorn (2013-04-10 15:39:30+00:00)
Title: Support for headers in package files

Currently carton insists that dependencies are specified in the `Carton` file. It does not support the standard `Package-Requires` header, nor does it read existing `-pkg.el` files.

MELPA however does not read Carton files, but insists on either `Package-Requires` or a `-pkg.el` file in the source tree.

To use Carton as a package author, while still deploying to MELPA, I can now either

- commit the `-pkg.el` file generated by Carton,
- or duplicate dependency information between `Carton` and the `Package-Requires` of `foo.el`.

Neither of these is particularly nice.

To cleanly work together with MELPA, either

- MELPA should support for Carton,
- or Carton should support the standard package headers.

The former is quite unlikely given that Carton is a non-standard approach, and that one of the MELPA devs [explicitly expressed his concerns about Carton support in MELPA](https://twitter.com/sanityinc/status/321573924490051584).

So ideally Carton would get support for standard package headers.

I'd propose the addition of a new directive `(package-file "foo.el)` which extracts package information from the `foo.el` file, following the [library header conventions](http://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html#Library-Headers), and thus works as a complete replacement for all top-level `package` and `depends-on` directives.

Precisely, with this directive Carton would

- extract the package name from the file name in the first line,
- extract the package description form the first line,
- read the package version from the `Package-Version` header if present, or the `Version` header,
- read the runtime dependencies from the `Package-Requires` header.

The package archives would still be read from the `source` directive, as would all development dependencies from the `development` directive.

Thus, an example `Carton` following this scheme would look like:
```scheme
(source "melpa" "http://melpa.milkbox.net/packages/")

(package-file "foo.el")

(development
(depends-on "ecukes"))
```