summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-05-09 12:19:09 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-05-09 12:19:09 (GMT)
commit17433d206c1a705c8dad9a52d33c5546dc069e42 (patch)
treeda6cd0f946dd029a5596dadd5478615c6d1da657 /Lib/distutils
parentba290db6017d75d5fc5cf20e0eed566102175209 (diff)
downloadcpython-17433d206c1a705c8dad9a52d33c5546dc069e42.zip
cpython-17433d206c1a705c8dad9a52d33c5546dc069e42.tar.gz
cpython-17433d206c1a705c8dad9a52d33c5546dc069e42.tar.bz2
Add --user option to build_ext
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/command/build_ext.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index bf5ad7e..beb3319 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -10,6 +10,7 @@ __revision__ = "$Id$"
import sys, os, string, re
from types import *
+from site import USER_BASE, USER_SITE
from distutils.core import Command
from distutils.errors import *
from distutils.sysconfig import customize_compiler, get_python_version
@@ -93,9 +94,11 @@ 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']
+ boolean_options = ['inplace', 'debug', 'force', 'swig-cpp', 'user']
help_options = [
('help-compiler', None,
@@ -123,6 +126,7 @@ class build_ext (Command):
self.swig = None
self.swig_cpp = None
self.swig_opts = None
+ self.user = None
def finalize_options (self):
from distutils import sysconfig
@@ -257,6 +261,16 @@ class build_ext (Command):
else:
self.swig_opts = self.swig_opts.split(' ')
+ # Finally add the user include and library directories if requested
+ if self.user:
+ user_include = os.path.join(USER_BASE, "include")
+ user_lib = os.path.join(USER_BASE, "lib")
+ if os.path.isdir(user_include):
+ self.include_dirs.append(user_include)
+ if os.path.isdir(user_lib):
+ self.library_dirs.append(user_lib)
+ self.rpath.append(user_lib)
+
# finalize_options ()