diff options
| author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-27 12:53:34 (GMT) |
|---|---|---|
| committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-27 12:53:34 (GMT) |
| commit | dda92f7f02dbc0de94112599129d9d93192278d9 (patch) | |
| tree | 8912eab7b7848c451a9aabc871682921776cee11 /Lib/distutils/command/build_ext.py | |
| parent | b31a6d0949faecc933754f32ac956bc4aad76fff (diff) | |
| download | cpython-dda92f7f02dbc0de94112599129d9d93192278d9.zip cpython-dda92f7f02dbc0de94112599129d9d93192278d9.tar.gz cpython-dda92f7f02dbc0de94112599129d9d93192278d9.tar.bz2 | |
Issue #5052: make Distutils compatible with 2.3 again.
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 ac0a067..125fa7f 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -8,7 +8,6 @@ __revision__ = "$Id$" import sys, os, string, re from types import * -from site import USER_BASE from distutils.core import Command from distutils.errors import * from distutils.sysconfig import customize_compiler, get_python_version @@ -17,6 +16,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()) @@ -92,11 +99,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, |
