<br><br><div class="gmail_quote">On Mon, Jun 22, 2009 at 4:59 PM, Antoine Pitrou <span dir="ltr"><<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
- the **MD5** hash of the file, encoded in hex. Notice that `pyc` and `pyo`<br>
generated files will not have a hash.<br>
<br>
Why the exception for pyc and pyo files?</blockquote><div><br>As in PEP 262, since they are produced automatically from a py file, checking the py file is enough<br>to decide if the file has changed.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
- `zlib` and `zlib-2.5.2.egg-info` are located in `site-packages` so the file<br>
paths are relative to it.<br>
<br>
Is it a general rule? That is, the paths in RECORD are always relative to its<br>
grandparent directory?</blockquote><div><br><br>no, they can be located anywhere on the system. But when the paths are located in the <br>same directory where the .egg-info directory is located, a relative path is used. (see the section before this example)<br>
<br>I'll add an example that contains files located elswhere in the system (like a script and a data file)<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
The RECORD format<br>
-----------------<br>
<br>
The `RECORD` file is a CSV file, composed of records, one line per<br>
installed file. The ``csv`` module is used to read the file, with<br>
the `excel` dialect, which uses these options to read the file:<br>
<br>
- field delimiter : `,`<br>
- quoting char : `"`.<br>
- line terminator : `\r\n`<br>
<br>
Wouldn't it be better to use the native line terminator on the current<br>
platform? (someone might want to edit or at least view the file)</blockquote><div><br>Good idea, I'll change that,<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
What is the character encoding for non-ASCII filenames? UTF-8?<br>
</blockquote><div><br>Yes, there's a constant in Distutils, called PKG_INFO_ENCODING that will be used for the file generation.<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Are the RECORD file's contents somehow part of the DistributionMetadata?</blockquote><div><br><br>The DistributionMetadata correspond to the fields defined in PEP 345, e.g. written in the PKG-INFO file,<br>which is mentioned in the RECORD file.<br>
<br>We are reworking PEP 345 as well, to add some fields. What did you have in mind ?<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
- ``DistributionDirectories``: manages ``EggInfoDirectory`` instances.<br>
<br>
What is an EggInfoDirectory ?</blockquote><div><br>Typo (old name), fixing this..<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
A plural class name looks strange (I think it's the first time I see one in<br>
the CPython codebase). How about another name? (DistributionPool,<br>
DistributionMap, WorkingSet etc.).</blockquote><div><br>Sure, WorkingSet is nice, it's the name used in setuptools, <br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
- ``get_egginfo_file(path, binary=False)`` -> file object<br>
<br>
Returns a file located under the `.egg-info` directory.<br>
<br>
Returns a ``file`` instance for the file pointed by ``path``.<br>
<br>
Is it always a file instance or just a file-like object? (zipped distributions<br>
come to mind). Is it opened read-only?</blockquote><div><br><br>It's in read-only mode, either "r" either "rb" and in case of a zip file, <br>it returns a file-like object using zipfile.ZipFile.open.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
- ``owner(path)`` -> ``Distribution`` instance or None<br>
<br>
If ``path`` is used by only one ``Distribution`` instance, returns it.<br>
Otherwise returns None.<br>
<br>
This is a bit confusing. If it returns None, it doesn't distinguish between the<br>
case where several Distributions refer to the path, and the case where no<br>
distributions refer to it, does it?<br>
</blockquote><div><br>The idea of this API is to find out of a distribution "owns" a file, e.g. is the only distribution<br>
that uses it, so it can be safely removed.
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Is there any reason to have this method while file_users(path) already exists?<br>
</blockquote><div><br>Its just a helper for uninstallers, but file_users() could probably be enough,<br>I can remove "owns" if people find it confusing,<br><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
A new class called ``DistributionDirectories`` is created. It's a collection of<br>
``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances.<br>
The constructor takes one optional argument ``use_cache`` set to ``True`` by<br>
default.<br>
<br>
You forgot to describe the constructor's signature and what it does exactly.<br>
</blockquote><div><br>I'll add that,<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
``EggInfoDirectories`` also provides the following methods besides the ones<br>
from ``dict``::<br>
<br>
What is EggInfoDirectories?</blockquote><div><br>This is a DistributionDirectories, one more instance I forgot to rename, I'll fix that<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
- ``append(path)``<br>
<br>
Creates an ``DistributionDirectory`` (or ``ZippedDistributionDirectory``)<br>
instance for ``path`` and adds it in the mapping.<br>
<br>
- ``load(paths)``<br>
<br>
Creates and adds ``DistributionDirectory`` (or<br>
``ZippedDistributionDirectory``) instances corresponding to ``paths``.<br>
<br>
Why are these methods named completely differently although they do almost the<br>
same thing? Besides, append() makes it look like ordering matters. Does it?<br>
(for a naming suggestion, e.g. load(path) and load_all(paths). Or,<br>
even simpler, load(*paths) or load(paths))<br>
</blockquote><div><br>Right, I'll fix that,<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
- ``get_file_users(path)`` -> Iterator of ``Distribution`` (or<br>
``ZippedDistribution``) instances.<br>
<br>
This method is named file_users in another class. Perhaps the naming should be<br>
consistent?</blockquote><div><br>Right, it used to be get_*, that's a typo. I'll fix it,<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
All these functions use the same global instance of ``DistributionDirectories``<br>
to use the cache.<br>
<br>
Is the global instance available to users?</blockquote><div><br>No I didn't made it available to avoid concurrency problems,<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
>>> for path, hash, size in dist.get_installed_files()::<br>
... print '%s %s %d %s' % (path, hash, size)<br>
<br>
There's one too many "%s" here.<br>
</blockquote><div><br>Fixing it too,<br><br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Thanks for your work!<br>
</blockquote><div><br><br>Thanks for the feedback, I'll commit the fixes asap.<br><br>Tarek<br><br></div></div>