From 2b5029c57a70ccb819e48310c0c4b8bd250bd5c9 Mon Sep 17 00:00:00 2001 From: Dmitry Gladkov Date: Mon, 18 Mar 2013 12:42:09 +0200 Subject: [PATCH] #309 add global config file support --- pip/baseparser.py | 4 ++-- pip/locations.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pip/baseparser.py b/pip/baseparser.py index 7e3a8ac6fa1..2e4cb1b521a 100644 --- a/pip/baseparser.py +++ b/pip/baseparser.py @@ -7,7 +7,7 @@ import textwrap from distutils.util import strtobool from pip.backwardcompat import ConfigParser, string_types, ssl -from pip.locations import default_config_file, default_log_file +from pip.locations import default_config_file, default_log_file, global_config_file from pip.util import get_terminal_size, get_prog @@ -137,7 +137,7 @@ def get_config_files(self): config_file = os.environ.get('PIP_CONFIG_FILE', False) if config_file and os.path.exists(config_file): return [config_file] - return [default_config_file] + return [global_config_file, default_config_file] def update_defaults(self, defaults): """Updates the given defaults with values from the config files and diff --git a/pip/locations.py b/pip/locations.py index 8bc5798a36f..8b8ea0e3aaa 100644 --- a/pip/locations.py +++ b/pip/locations.py @@ -88,11 +88,14 @@ def _get_build_prefix(): default_storage_dir = os.path.join(user_dir, 'pip') default_config_file = os.path.join(default_storage_dir, 'pip.ini') default_log_file = os.path.join(default_storage_dir, 'pip.log') + global_config_file = os.path.join(os.environ['ALLUSERSPROFILE'], + 'Application Data', 'pip', 'pip.ini') else: bin_py = os.path.join(sys.prefix, 'bin') default_storage_dir = os.path.join(user_dir, '.pip') default_config_file = os.path.join(default_storage_dir, 'pip.conf') default_log_file = os.path.join(default_storage_dir, 'pip.log') + global_config_file = '/etc/pip.conf' # Forcing to use /usr/local/bin for standard Mac OS X framework installs # Also log to ~/Library/Logs/ for use with the Console.app log viewer