mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Closes issue #17732: ignore install-directory specific options in
distutils.cfg when a venv is active.
This commit is contained in:
parent
b3bd624a55
commit
521ed52131
5 changed files with 87 additions and 3 deletions
|
@ -343,6 +343,18 @@ Common commands: (see '--help-commands' for more)
|
|||
def parse_config_files(self, filenames=None):
|
||||
from configparser import ConfigParser
|
||||
|
||||
# Ignore install directory options if we have a venv
|
||||
if sys.prefix != sys.base_prefix:
|
||||
ignore_options = [
|
||||
'install-base', 'install-platbase', 'install-lib',
|
||||
'install-platlib', 'install-purelib', 'install-headers',
|
||||
'install-scripts', 'install-data', 'prefix', 'exec-prefix',
|
||||
'home', 'user', 'root']
|
||||
else:
|
||||
ignore_options = []
|
||||
|
||||
ignore_options = frozenset(ignore_options)
|
||||
|
||||
if filenames is None:
|
||||
filenames = self.find_config_files()
|
||||
|
||||
|
@ -359,7 +371,7 @@ Common commands: (see '--help-commands' for more)
|
|||
opt_dict = self.get_option_dict(section)
|
||||
|
||||
for opt in options:
|
||||
if opt != '__name__':
|
||||
if opt != '__name__' and opt not in ignore_options:
|
||||
val = parser.get(section,opt)
|
||||
opt = opt.replace('-', '_')
|
||||
opt_dict[opt] = (filename, val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue