--- Lib/distutils/dist.py.old 2014-10-12 08:52:02.000000000 +0200 +++ Lib/distutils/dist.py 2016-08-01 06:07:29.000000000 +0200 @@ -51,6 +51,7 @@ class Distribution: ('quiet', 'q', "run quietly (turns verbosity off)"), ('dry-run', 'n', "don't actually do anything"), ('help', 'h', "show detailed help message"), + ('no-user-cfg', None,'ignore pydistutils.cfg in your home directory'), ] # 'common_usage' is a short (2-3 line) string describing the common @@ -258,6 +259,12 @@ Common commands: (see '--help-commands' else: sys.stderr.write(msg + "\n") + # no-user-cfg is handled before other command line args + # because other args override the config files, and this + # one is needed before we can load the config files. + # If attrs['script_args'] wasn't passed, assume false. + self.want_user_cfg = '--no-user-cfg' not in (self.script_args or []) + self.finalize_options() def get_option_dict(self, command): @@ -310,6 +317,9 @@ Common commands: (see '--help-commands' Distutils __inst__.py file lives), a file in the user's home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac, and setup.cfg in the current directory. + + The file in the user's home directory can be disabled with the + --no-user-cfg option. """ files = [] check_environ() @@ -330,7 +340,7 @@ Common commands: (see '--help-commands' # And look for the user config file user_file = os.path.join(os.path.expanduser('~'), user_filename) - if os.path.isfile(user_file): + if self.want_user_cfg and os.path.isfile(user_file): files.append(user_file) # All platforms support local setup.cfg @@ -338,6 +348,8 @@ Common commands: (see '--help-commands' if os.path.isfile(local_file): files.append(local_file) + if DEBUG: + print("using config files: %s" % ', '.join(files)) return files def parse_config_files(self, filenames=None):