[New-bugs-announce] [issue22269] Resolve distutils option conflicts with priorities

Min RK report at bugs.python.org
Mon Aug 25 00:32:24 CEST 2014


New submission from Min RK:

Background:

Some Python distros (OS X, Debian, Homebrew, others) want the default installation prefix for packages to differ from sys.prefix. OS X and Debian accomplish this by patching distutils itself, with special cases like `if sys.prefix == '/System/Library/...': actually_do_something_else()`. Homebrew accomplishes this by writing a `distutils.cfg` with:

    [install]
    prefix = /usr/local

The distutils.cfg approach is certainly simpler than shipping a patch, but has its own problems, because distutils doesn't differentiate the *source* of configuration options when resolving conflicts. That means that you can't do `python setup.py install --user` because it fails with the error "can't combine user with prefix, ..." without also specifying `--prefix=''` to eliminate the conflict.

Proposal:

I've included a patch for discussion, which uses the fact that the option_dict tracks the source of each option, and keeps track of the load order of each. In the case of an option conflict, the option that came from the lower priority source is unset back to None. If they come from the same source, then the same conflict error message is displayed as before.

Even if this patch is rejected as madness, as I expect it might be, official  recommendations on how to address the root question of `sys.prefix != install_prefix` would be appreciated.

----------
components: Distutils
files: distutils_conflict.patch
keywords: patch
messages: 225843
nosy: dstufft, eric.araujo, minrk
priority: normal
severity: normal
status: open
title: Resolve distutils option conflicts with priorities
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36459/distutils_conflict.patch

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


More information about the New-bugs-announce mailing list