[issue15364] sysconfig confused by relative paths

Richard Oudkerk report at bugs.python.org
Thu Jul 19 17:16:28 CEST 2012


Richard Oudkerk <shibturn at gmail.com> added the comment:

> I'd make get_config_var('srcdir') to be None for installed systems, 
> because the source tree is not available there.

While playing with a version of the patch which returns None for non-source builds, I found that distutils.support._get_xxmodule_path() depends on get_config_var('srcdir') always returning a string:

def _get_xxmodule_path():
    srcdir = sysconfig.get_config_var('srcdir')
    candidates = [
        os.path.join(os.path.dirname(__file__), 'xxmodule.c'),
        os.path.join(srcdir, 'Modules', 'xxmodule.c'),
        os.path.join(srcdir, '..', '..', '..', 'Modules', 'xxmodule.c'),
    ]
    for path in candidates:
        if os.path.exists(path):
            return path

It is easy enough to modify _get_xxmodule_path() to check for None.  But this does suggest that returning None might break some currently working 3rd party code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15364>
_______________________________________


More information about the Python-bugs-list mailing list