[Distutils] RECORD format in PEP 376

Tarek Ziadé ziade.tarek at gmail.com
Mon Mar 29 10:07:07 CEST 2010


I'd like to make the RECORD file dead simple for PEP 376, and remove
all the relocatable work we've started in it, since it'll go in a
file. This would be done in a second phase, with the work done at Pycon.

So what I am proposing to keep in the PEP is this:

The `RECORD` file is a CSV file, composed of records, one line per
installed file. The ``csv`` module is used to read the file, with
these options:

- field delimiter : `,`
- quoting char :  `"`.
- line terminator : ``os.linesep`` (so ``\r\n`` or ``\n``)

Each record is composed of three elements.

- the file's full **path**, as defined by the target system/
- the **MD5** hash of the file, encoded in hex. Notice that `pyc` and
`pyo` generated files don't have any hash because they are
  automatically produced from `py` files. So checking the hash of the
corresponding `py` file is enough to decide if the file and its
  associated `pyc` or `pyo` files have changed.
- the file's size in bytes

The ``csv`` module is used to generate this file, so the field separator is
",". Any "," characters found within a field is escaped automatically
by ``csv``.

When the file is read, the `U` option is used so the universal newline
support (see PEP 278 [#pep278]_) is activated, avoiding any trouble
reading a file produced on a platform that uses a different new line

I think this is getting close to what Pip has today.

Opinions ?

Tarek Ziadé | http://ziade.org

More information about the Distutils-SIG mailing list