summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/dist.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2013-05-12 10:36:07 (GMT)
committerGeorg Brandl <georg@python.org>2013-05-12 10:36:07 (GMT)
commit521ed521317ffd385afaabdd889879e7cb7461df (patch)
treef53b513ccf4aa1b3ef6286730ba7b2a5fdf6aa6e /Lib/distutils/dist.py
parentb3bd624a55ea5bf3a0e77cfa9d987d82ed23652f (diff)
downloadcpython-521ed521317ffd385afaabdd889879e7cb7461df.zip
cpython-521ed521317ffd385afaabdd889879e7cb7461df.tar.gz
cpython-521ed521317ffd385afaabdd889879e7cb7461df.tar.bz2
Closes issue #17732: ignore install-directory specific options in
distutils.cfg when a venv is active.
Diffstat (limited to 'Lib/distutils/dist.py')
-rw-r--r--Lib/distutils/dist.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index a702568..f7fac08 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -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)