~ubuntu-branches/ubuntu/oneiric/python-distutils-extra/oneiric

« back to all changes in this revision

Viewing changes to DistUtilsExtra/auto.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-06-16 13:39:30 UTC
  • mfrom: (18.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110616133930-4sbgmwocxiw0i9c7
Tags: 2.28-1
* Urgency medium as this fixes a nasty regression from 2.27 which causes
  some packages to FTBFS.
* debian/local/python-mkdebian{,.1}: Change --force-control from a binary to
  a ternary option with modes "none" (don't touch it at all), "deps" (only
  update dependencies; old and new default behaviour), and "full" (always
  regenerate it). Update the manpage accordingly. Thanks to Jordan Mantha
  for the patch!
* test/auto.py: Add test for a local module which raises an exception
  (replicates the current xdiagnose FTBFS), and a local module which runs
  optparse on import (replicates the current onboard bzr head FTBFS).
* auto.py, __external_mod(): Put back the early decision for locally
  provided modules based on their name, without importing them. Running
  __import__ is dangerous in some cases like the above two, but
  unfortunately necessary to fully determine relative imports. This is still
  not quite perfect, as it will fail the same way if externally provided
  modules do dangerous things on mere imports, but at least fixes the
  regression from r248 (release 2.27). (See LP #746565)

Show diffs side-by-side

added added

removed removed

Lines of Context:
311
311
def __external_mod(cur_module, module, attrs):
312
312
    '''Check if given Python module is not included in Python or locally'''
313
313
 
 
314
    # filter out locally provided modules early, to avoid importing them (which
 
315
    # might raise an exception, or parse argv, etc.)
 
316
    if module in attrs['provides']:
 
317
        return False
 
318
    for m in _module_parents(module):
 
319
        if m in attrs['provides']:
 
320
            return False
 
321
 
314
322
    try:
315
323
        mod = __import__(module)
316
324
    except ImportError: