[Python-Dev] distutils 'depends' management (original) (raw)
Matteo Bertini matteo at naufraghi.net
Mon Feb 6 10:35:55 CET 2012
- Previous message: [Python-Dev] distutils 'depends' management
- Next message: [Python-Dev] Summary of Python tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Feb 3, 2012 at 5:52 PM, Éric Araujo <merwok at netwok.org> wrote:
Hi Matteo,
Now setup.py will rebuild all every time, this is because the policy of newergroup in buildextension is to consider 'newer' any missing file.
Here you certainly mean “older”.
No, and this is the problem: newer_group(depends, ext_path, 'newer'))
if (some dep is newer than the target): rebuild
[...] Can someone suggest me the reason of this choice
distutils’ notion of dependencies directly comes from make. A missing (not existing) target is perfectly normal: it’s usually a generated file that make needs to create (i.e. compile from source files). In this world, you want to (re-)compile when the target is older than the sources, or when the target is missing.
Here is a simple Makefile that has the behavior I was expecting from distutils too:
$ cat Makefile all: missing.dep echo "Done!"
$ make
make: *** No rule to make target missing.dep', needed by
all'. Stop.
So here your extension module is a target that needs to be created, and
when distutils does not find a file with the name you give in depends, it just thinks it’s another thing that will be generated.
So, if I understand correctly, starting today a better name could be 'generates' instead of 'depends'?
This model is inherently prone to typos; I’m not sure how we can improve
it to let people catch possible typos.
Yes, perhaps the name of the list and the explanation in the docs are both a bit confusing:
http://docs.python.org/distutils/apiref.html#distutils.ccompiler.CCompiler.compile
depends, if given, is a list of filenames that all targets depend on. If
a source file is older than any file in depends, then the source file will be recompiled.
Can this be a better explanation? "If a source file is older than any file in depends {+or if some depend is missing+}"
Cheers
-- Matteo Bertini http://www.slug.it/naufraghi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120206/c0d37653/attachment.html>
- Previous message: [Python-Dev] distutils 'depends' management
- Next message: [Python-Dev] Summary of Python tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]