Author paul.moore
Recipients dstufft, ncoghlan, paul.moore, python-dev, r.david.murray
Date 2014-02-07.18:37:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391798274.18.0.711073201561.issue20053@psf.upfronthosting.co.za>
In-reply-to
Content
In ensurepip, _disable_pip_configuration_settings has the line:

    os.environ['PIP_CONFIG_FILE'] = os.devnull

On Windows, os.devnull does not behave like a real file in that os.path.exists(os.devnull) is False even though opening it works fine. So that line of code is not portable to Windows.

The problem in pip us in baseparser.py in ConfigOptionParser:

    def get_config_files(self):
        config_file = os.environ.get('PIP_CONFIG_FILE', False)
        if config_file and os.path.exists(config_file):
            files = [config_file]
        else:
            files = [default_config_file]

There's no way to force pip to *not* use a config file.

A quick hack would be to respect a new environment variable (PIP_NO_CONFIG_FILE) which if set says to set files to [] here. A bigger fix is to implement a proper "isolated mode" in pip.

I could probably knock up the "quick hack" as a PR for pip reasonably easily.

This should really be discussed on the pip tracker, though. Nick - did you raise an issue on pip for this? Assuming you did, can you post the reference here?

Either way, ensurepip needs to be changed to use whatever mechanism pip implements. I am against special casing os.devnull in pip just to make this work (although it would address the issue).
History
Date User Action Args
2014-02-07 18:37:54paul.mooresetrecipients: + paul.moore, ncoghlan, r.david.murray, python-dev, dstufft
2014-02-07 18:37:54paul.mooresetmessageid: <1391798274.18.0.711073201561.issue20053@psf.upfronthosting.co.za>
2014-02-07 18:37:54paul.moorelinkissue20053 messages
2014-02-07 18:37:53paul.moorecreate