[Python-Dev] distutils 'depends' management

Matteo Bertini matteo at naufraghi.net
Wed Jan 25 10:41:20 CET 2012


Hello,
I've noted that distutils manages depends in a way I cannot understand.

Suppose I have a minimal setup.py:

from distutils.core import setup, Extension
setup(
  name='foo',
  version='1.0',
  ext_modules=[
    Extension('foo',
      sources=['foo.c'],
      depends=['fop.conf'] # <---- note the typo foo->fop
    ),
  ]
)

Now setup.py will rebuild all every time, this is because the policy of
newer_group in build_extension is to consider 'newer' any missing file.

http://bit.ly/build_ext_471

def build_extension(self, ext):
...
    depends = sources + ext.depends
    if not (self.force or newer_group(depends, ext_path, 'newer')):
        logger.debug("skipping '%s' extension (up-to-date)", ext.name)
        return
    else:
        logger.info("building '%s' extension", ext.name)
...


Can someone suggest me the reason of this choice instead of
missing='error' (at least for ext.depends)?

Cheers,
Matteo



More information about the Python-Dev mailing list