Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

avoid conflicts caused by setting install.prefix in distutils.cfg #31811

Closed
wants to merge 1 commit into from

Conversation

minrk
Copy link
Contributor

@minrk minrk commented Aug 22, 2014

Setting install.prefix in distutils.cfg causes conflicts with other options set on the command-line, such as --user. This adds a check to distutils command-line parsing to unset install.prefix if such a conflict would be caused by settings from a higher priority source (e.g. command-line).

Supersedes #31803 by hopefully being less gross.

This addresses what I would consider a bug in Python distutils, and thus has the chance of evolving into an upstream patch: settings found in distutils.cfg are treated as if they were typed at the command-line in terms of conflict resolution, rather than as if they were defaults to be overridden. A generic patch for distutils to fix this logic would be more complex, but this simple patch handles the case that affects Homebrew Python as it is today.

setting `install.prefix` in `distutils.cfg` causes
conflicts with other options set on the command-line,
such as `--user`. This adds a check to distutils command-line parsing
to unset `install.prefix` if such a conflict would be caused
by settings from a higher priority source (e.g. command-line).
@MikeMcQuaid
Copy link
Member

I'd like to see this submitted and discussed upstream before we include it. We only want to include patches of this form that are already on their way upstream rather than using our users as a testing ground for patches. Happy to leave this open until then for discussion.

@minrk
Copy link
Contributor Author

minrk commented Aug 24, 2014

Fair enough. I'll take a stab at the more generic upstream patch, but it might be more complicated than I am comfortable proposing, whereas the patch here needs only to address the problems caused by setting prefix in a config file. Still worth pinging upstream about what they think the best way to resolve the root problem of sys.prefix not being the desired default install prefix.

@minrk
Copy link
Contributor Author

minrk commented Aug 24, 2014

I opened an issue upstream. We'll see how it goes.

@adamv adamv added the python label Sep 25, 2014
@tdsmith
Copy link
Contributor

tdsmith commented Dec 23, 2014

The upstream patch is stalled for want of review and it's unlikely to be applied to python 2.x. I understand that Debian and Apple apply similar patches. We could ask pip to do something about this (they just pass options through to setup.py, which calls functions from distutils in Python's stdlib).

I'm starting to favor carrying a patch like this.

@tdsmith
Copy link
Contributor

tdsmith commented Jun 29, 2015

Partially resolved (in pip) by pypa/pip#2934; direct setup.py invocations will still fail without the workaround.

@bfontaine
Copy link
Contributor

This PR needs to be rebased on top of master.

@minrk minrk closed this Oct 13, 2015
@Homebrew Homebrew locked and limited conversation to collaborators Jul 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants