From bfe2e002ddc09e0c96267733940a5c1d2ae89ef3 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Thu, 26 Jan 2006 22:08:07 +0000 Subject: Expand ``$variables`` used in the ``--site-dirs``, ``--build-directory``, ``--install-dir``, and ``--script-dir`` options, whether on the command line or in configuration files. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4042191 --- setuptools/command/easy_install.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'setuptools/command/easy_install.py') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index a64997f7..e6777011 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -122,6 +122,7 @@ class easy_install(Command): os.unlink(filename) def finalize_options(self): + self._expand('install_dir','script_dir','build_directory','site_dirs') # If a non-default installation directory was specified, default the # script directory to match it. if self.script_dir is None: @@ -154,7 +155,6 @@ class easy_install(Command): ) else: self.all_site_dirs.append(normalize_path(d)) - instdir = normalize_path(self.install_dir or self.all_site_dirs[-1]) if instdir in self.all_site_dirs: if self.pth_file is None: @@ -887,15 +887,15 @@ See the setuptools documentation for the "develop" command for more info. finally: log.set_verbosity(self.verbose) # restore original verbosity - - - - - - - - - + def _expand(self, *attrs): + config_vars = self.get_finalized_command('install').config_vars + for attr in attrs: + val = getattr(self, attr) + if val is not None: + if os.name == 'posix': + val = os.path.expanduser(val) + val = subst_vars(val, config_vars) + setattr(self, attr, val) -- cgit v1.2.1