summaryrefslogtreecommitdiff
path: root/distutils2/command/install_dist.py
diff options
context:
space:
mode:
author?ric Araujo <merwok@netwok.org>2012-05-21 17:03:13 -0400
committer?ric Araujo <merwok@netwok.org>2012-05-21 17:03:13 -0400
commit7e12306509188e264a99b529d16cc5f80839b2f6 (patch)
tree2a8b797e061e4d2c26a5319d5f9d93895e3e569a /distutils2/command/install_dist.py
parent273927821682f7abba2c961671e26d3274bb9b02 (diff)
parentee6fb9f7f0863a1d0020d57f224947f7b795df6d (diff)
downloaddisutils2-7e12306509188e264a99b529d16cc5f80839b2f6.tar.gz
Merge from default
Diffstat (limited to 'distutils2/command/install_dist.py')
-rw-r--r--distutils2/command/install_dist.py55
1 files changed, 19 insertions, 36 deletions
diff --git a/distutils2/command/install_dist.py b/distutils2/command/install_dist.py
index e11a6d3..3dc481c 100644
--- a/distutils2/command/install_dist.py
+++ b/distutils2/command/install_dist.py
@@ -13,11 +13,6 @@ from distutils2.util import write_file
from distutils2.util import convert_path, change_root, get_platform
from distutils2.errors import PackagingOptionError
-if sys.version_info[:2] >= (2, 6):
- HAS_USER_SITE = True
-else:
- HAS_USER_SITE = False
-
class install_dist(Command):
@@ -29,6 +24,9 @@ class install_dist(Command):
"installation prefix"),
('exec-prefix=', None,
"(Unix only) prefix for platform-specific files"),
+ ('user', None,
+ "install in user site-packages directory [%s]" %
+ get_path('purelib', '%s_user' % os.name)),
('home=', None,
"(Unix only) home directory to install under"),
@@ -97,15 +95,7 @@ class install_dist(Command):
]
boolean_options = ['compile', 'force', 'skip-build', 'no-distinfo',
- 'requested', 'no-record']
-
- if HAS_USER_SITE:
- user_options.append(
- ('user', None,
- "install in user site-packages directory [%s]" %
- get_path('purelib', '%s_user' % os.name)))
-
- boolean_options.append('user')
+ 'requested', 'no-record', 'user']
negative_opt = {'no-compile': 'compile', 'no-requested': 'requested'}
@@ -115,8 +105,7 @@ class install_dist(Command):
self.prefix = None
self.exec_prefix = None
self.home = None
- if HAS_USER_SITE:
- self.user = False
+ self.user = False
# These select only the installation base; it's up to the user to
# specify the installation scheme (currently, that means supplying
@@ -135,9 +124,8 @@ class install_dist(Command):
self.install_lib = None # set to either purelib or platlib
self.install_scripts = None
self.install_data = None
- if HAS_USER_SITE:
- self.install_userbase = get_config_var('userbase')
- self.install_usersite = get_path('purelib', '%s_user' % os.name)
+ self.install_userbase = get_config_var('userbase')
+ self.install_usersite = get_path('purelib', '%s_user' % os.name)
self.compile = None
self.optimize = None
@@ -218,9 +206,8 @@ class install_dist(Command):
raise PackagingOptionError(
"must supply either home or prefix/exec-prefix -- not both")
- if HAS_USER_SITE and self.user and (
- self.prefix or self.exec_prefix or self.home or
- self.install_base or self.install_platbase):
+ if self.user and (self.prefix or self.exec_prefix or self.home or
+ self.install_base or self.install_platbase):
raise PackagingOptionError(
"can't combine user with prefix/exec_prefix/home or "
"install_base/install_platbase")
@@ -273,11 +260,9 @@ class install_dist(Command):
'exec_prefix': exec_prefix,
'srcdir': srcdir,
'projectbase': projectbase,
- }
-
- if HAS_USER_SITE:
- self.config_vars['userbase'] = self.install_userbase
- self.config_vars['usersite'] = self.install_usersite
+ 'userbase': self.install_userbase,
+ 'usersite': self.install_usersite,
+ }
self.expand_basedirs()
@@ -295,7 +280,7 @@ class install_dist(Command):
self.dump_dirs("post-expand_dirs()")
# Create directories under USERBASE
- if HAS_USER_SITE and self.user:
+ if self.user:
self.create_user_dirs()
# Pick the actual directory to install all modules to: either
@@ -310,10 +295,8 @@ class install_dist(Command):
# Convert directories from Unix /-separated syntax to the local
# convention.
- self.convert_paths('lib', 'purelib', 'platlib',
- 'scripts', 'data', 'headers')
- if HAS_USER_SITE:
- self.convert_paths('userbase', 'usersite')
+ self.convert_paths('lib', 'purelib', 'platlib', 'scripts',
+ 'data', 'headers', 'userbase', 'usersite')
# Well, we're not actually fully completely finalized yet: we still
# have to deal with 'extra_path', which is the hack for allowing
@@ -354,7 +337,7 @@ class install_dist(Command):
"installation scheme is incomplete")
return
- if HAS_USER_SITE and self.user:
+ if self.user:
if self.install_userbase is None:
raise PackagingPlatformError(
"user base directory is not specified")
@@ -382,7 +365,7 @@ class install_dist(Command):
def finalize_other(self):
"""Finalize options for non-posix platforms"""
- if HAS_USER_SITE and self.user:
+ if self.user:
if self.install_userbase is None:
raise PackagingPlatformError(
"user base directory is not specified")
@@ -463,7 +446,7 @@ class install_dist(Command):
self.extra_path = self.distribution.extra_path
if self.extra_path is not None:
- if isinstance(self.extra_path, basestring):
+ if isinstance(self.extra_path, str):
self.extra_path = self.extra_path.split(',')
if len(self.extra_path) == 1:
@@ -498,7 +481,7 @@ class install_dist(Command):
home = convert_path(os.path.expanduser("~"))
for name, path in self.config_vars.items():
if path.startswith(home) and not os.path.isdir(path):
- os.makedirs(path, 0700)
+ os.makedirs(path, 0o700)
# -- Command execution methods -------------------------------------