aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command
diff options
context:
space:
mode:
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-02-11 23:57:28 +0100
committerRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-02-11 23:57:28 +0100
commit0b3d2302b8b209c7bed8bdad6e1a6cff34889779 (patch)
tree7384e901fa3d4a7c99ccd95fe97a2469936a3b3d /setuptools/command
parentc14e1a1398cf7ece7a4bcb15317868163789d879 (diff)
downloadexternal_python_setuptools-0b3d2302b8b209c7bed8bdad6e1a6cff34889779.tar.gz
external_python_setuptools-0b3d2302b8b209c7bed8bdad6e1a6cff34889779.tar.bz2
external_python_setuptools-0b3d2302b8b209c7bed8bdad6e1a6cff34889779.zip
move the rest of the path handling code from develop to easy_install
also resuffle the path handlers a bit, hopefully everything works now --HG-- branch : distribute extra : rebase_source : dc8e4217f5832b15e8f7287c95732bc68d1e1cf5
Diffstat (limited to 'setuptools/command')
-rwxr-xr-xsetuptools/command/develop.py19
-rwxr-xr-xsetuptools/command/easy_install.py62
2 files changed, 43 insertions, 38 deletions
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py
index d88d0990..93b7773c 100755
--- a/setuptools/command/develop.py
+++ b/setuptools/command/develop.py
@@ -35,25 +35,6 @@ class develop(easy_install):
self.always_copy_from = '.' # always copy eggs installed in curdir
- def _expand_attrs(self, attrs):
- for attr in attrs:
- val = getattr(self, attr)
- if val is not None:
- if os.name == 'posix' or os.name == 'nt':
- val = os.path.expanduser(val)
- val = subst_vars(val, self.config_vars)
- setattr(self, attr, val)
-
- def expand_basedirs(self):
- """Calls `os.path.expanduser` on install_base, install_platbase and
- root."""
- self._expand_attrs(['install_base', 'install_platbase', 'root'])
-
- def expand_dirs(self):
- """Calls `os.path.expanduser` on install dirs."""
- self._expand_attrs(['install_purelib', 'install_platlib',
- 'install_lib', 'install_headers',
- 'install_scripts', 'install_data',])
def finalize_options(self):
ei = self.get_finalized_command("egg_info")
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index d7098060..134f1b80 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -17,13 +17,19 @@ from distutils import log, dir_util
from distutils.util import convert_path, subst_vars
from distutils.sysconfig import get_python_lib, get_config_vars
from distutils.errors import DistutilsArgError, DistutilsOptionError, \
- DistutilsError
+ DistutilsError, DistutilsPlatformError
from distutils.command.install import INSTALL_SCHEMES, SCHEME_KEYS
from setuptools.archive_util import unpack_archive
-from setuptools.package_index import PackageIndex, parse_bdist_wininst
+from setuptools.package_index import PackageIndex
from setuptools.package_index import URL_SCHEME
from setuptools.command import bdist_egg, egg_info
-from pkg_resources import *
+from pkg_resources import yield_lines, normalize_path, resource_string, \
+ ensure_directory, get_distribution, find_distributions, \
+ Environment, Requirement, Distribution, \
+ PathMetadata, EggMetadata, WorkingSet, \
+ DistributionNotFound, VersionConflict, \
+ DEVELOP_DIST
+
sys_executable = os.path.normpath(sys.executable)
__all__ = [
@@ -31,15 +37,8 @@ __all__ = [
'main', 'get_exe_prefixes',
]
-
-if sys.version < "2.6":
- USER_BASE = None
- USER_SITE = None
- HAS_USER_SITE = False
-else:
- from site import USER_BASE
- from site import USER_SITE
- HAS_USER_SITE = True
+import site
+HAS_USER_SITE = not sys.version < "2.6"
def samefile(p1,p2):
if hasattr(os.path,'samefile') and (
@@ -112,7 +111,7 @@ class easy_install(Command):
if HAS_USER_SITE:
user_options.append(('user', None,
- "install in user site-package '%s'" % USER_SITE))
+ "install in user site-package '%s'" % site.USER_SITE))
boolean_options.append('user')
@@ -140,8 +139,8 @@ class easy_install(Command):
self.install_data = None
self.install_base = None
self.install_platbase = None
- self.install_userbase = USER_BASE
- self.install_usersite = USER_SITE
+ self.install_userbase = site.USER_BASE
+ self.install_usersite = site.USER_SITE
# Options not specifiable via command line
self.package_index = None
@@ -209,10 +208,9 @@ class easy_install(Command):
else:
self.select_scheme(os.name + "_user")
- if self.user and self.install_purelib:
- self.install_dir = self.install_purelib
- self.script_dir = self.install_scripts
-
+ self.expand_basedirs()
+ self.expand_dirs()
+
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.
@@ -229,6 +227,10 @@ class easy_install(Command):
self.set_undefined_options('install_scripts',
('install_dir', 'script_dir')
)
+
+ if self.user and self.install_purelib:
+ self.install_dir = self.install_purelib
+ self.script_dir = self.install_scripts
# default --record from the install command
self.set_undefined_options('install', ('record', 'record'))
normpath = map(normalize_path, sys.path)
@@ -294,6 +296,27 @@ class easy_install(Command):
self.outputs = []
+
+ def _expand_attrs(self, attrs):
+ for attr in attrs:
+ val = getattr(self, attr)
+ if val is not None:
+ if os.name == 'posix' or os.name == 'nt':
+ val = os.path.expanduser(val)
+ val = subst_vars(val, self.config_vars)
+ setattr(self, attr, val)
+
+ def expand_basedirs(self):
+ """Calls `os.path.expanduser` on install_base, install_platbase and
+ root."""
+ self._expand_attrs(['install_base', 'install_platbase', 'root'])
+
+ def expand_dirs(self):
+ """Calls `os.path.expanduser` on install dirs."""
+ self._expand_attrs(['install_purelib', 'install_platlib',
+ 'install_lib', 'install_headers',
+ 'install_scripts', 'install_data',])
+
def run(self):
if self.verbose<>self.distribution.verbose:
log.set_verbosity(self.verbose)
@@ -337,6 +360,7 @@ class easy_install(Command):
def check_site_dir(self):
"""Verify that self.install_dir is .pth-capable dir, if needed"""
+ print 'install_dir', self.install_dir
instdir = normalize_path(self.install_dir)
pth_file = os.path.join(instdir,'easy-install.pth')