diff options
Diffstat (limited to 'Lib/distutils/command/build_ext.py')
-rw-r--r-- | Lib/distutils/command/build_ext.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 1d5a75d..1ed69f3 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -7,7 +7,6 @@ extensions ASAP).""" __revision__ = "$Id$" import sys, os, re -from site import USER_BASE from distutils.core import Command from distutils.errors import * from distutils.sysconfig import customize_compiler, get_python_version @@ -16,6 +15,14 @@ from distutils.extension import Extension from distutils.util import get_platform from distutils import log +# this keeps compatibility from 2.3 to 2.5 +if sys.version < "2.6": + USER_BASE = None + HAS_USER_SITE = False +else: + from site import USER_BASE + HAS_USER_SITE = True + if os.name == 'nt': from distutils.msvccompiler import get_build_version MSVC_VERSION = int(get_build_version()) @@ -91,11 +98,14 @@ class build_ext(Command): "list of SWIG command line options"), ('swig=', None, "path to the SWIG executable"), - ('user', None, - "add user include, library and rpath"), ] - boolean_options = ['inplace', 'debug', 'force', 'swig-cpp', 'user'] + boolean_options = ['inplace', 'debug', 'force', 'swig-cpp'] + + if HAS_USER_SITE: + user_options.append(('user', None, + "add user include, library and rpath")) + boolean_options.append('user') help_options = [ ('help-compiler', None, |