Richard Oudkerk <shibt...@gmail.com> added the comment: > Beyond that, I don't understand why the patch behavior depends on > whether the srcdir is an absolute path or not.
The os.path.isabs() test is actually redundant since os.path.join(base, srcdir) == srcdir if srcdir is an absolute path. I only added that test to be explicit about what happens if the original value is an absolute path. > I often use absolute paths to configure a build. If not in a build > directory, 'srcdir' should always return either the proposed value > based on what get_makefile_filename() returns or it should return > None. Removing the isabs() test would not change the calculated value as I indicated above. Using None would be the sanest option, but I don't know if any current code depends on the value being a string. > One other point: distutils still has its own copy of sysconfig. > Strong consideration should be given to making a similar change there. For a source build, distutils.sysconfig.get_config_var('srcdir') gives the right answer as an absolute path, *except* when the current working directory contains sys.executable. I think it should always return an absolute path. The fact that currently it does not probably explains the "mysteriously" comment below from distutils/test/support.py: def _get_xxmodule_path(): srcdir = sysconfig.get_config_var('srcdir') candidates = [ # use installed copy if available os.path.join(os.path.dirname(__file__), 'xxmodule.c'), # otherwise try using copy from build directory os.path.join(srcdir, 'Modules', 'xxmodule.c'), # srcdir mysteriously can be $srcdir/Lib/distutils/tests when # this file is run from its parent directory, so walk up the # tree to find the real srcdir os.path.join(srcdir, '..', '..', '..', 'Modules', 'xxmodule.c'), ] for path in candidates: if os.path.exists(path): return path BTW, I was wrong in my earlier message when I claimed that srcdir == get_path('stdlib') for an installed python. That is only true if the relative srcdir is '..'. The attached patch removes that check from the unit tests. ---------- Added file: http://bugs.python.org/file26422/sysconf.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15364> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com