summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/build_ext.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/command/build_ext.py')
-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 e011219..73cc00b 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -7,6 +7,7 @@ extensions ASAP)."""
__revision__ = "$Id$"
import sys, os, re
+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
@@ -90,9 +91,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,
@@ -120,6 +123,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
@@ -253,6 +257,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)
+
def run(self):
from distutils.ccompiler import new_compiler