classification
Title: ensurepip fails if cwd contains illformed setup.cf
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: FFY00, dstufft, htgoebel, ncoghlan, pradyunsg
Priority: normal Keywords:

Created on 2020-10-16 08:27 by htgoebel, last changed 2020-10-18 00:31 by FFY00.

Messages (1)
msg378706 - (view) Author: Hartmut Goebel (htgoebel) Date: 2020-10-16 08:27
If the current directory contains a ill-formed setup.cfg, setting up a virtual env fails, caused by ensurepip failing:

Expected behaviour:
running ensurepip should completely ignore the content of the current working directory.

How to reproduce:

$ rm -rf /tmp/v2
$ mkdir /tmp/v2
$ cd /tmp/v2
$ cat > setup.cfg <<EOF
> [options]
> setuptools_requires
> EOF
$ python3 -m venv /tmp/v2/_venv
Error: Command '['/tmp/v2/_venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 2.
$ /tmp/v2/_venv/bin/python3 -Im ensurepip --upgrade --default-pip
Looking in links: /tmp/tmpimoh6tke
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Exception:
…
configparser.ParsingError: Source contains parsing errors: 'setup.cfg'
        [line  2]: 'setuptools_requires\n'


Environment:
Tested with both Python 3.8.2 and 3.7.6
History
Date User Action Args
2020-10-18 00:31:06FFY00setnosy: + ncoghlan, dstufft, pradyunsg, FFY00
2020-10-16 08:27:23htgoebelcreate