diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/command/build_ext.py | 16 | ||||
-rw-r--r-- | Lib/site.py | 2 | ||||
-rw-r--r-- | Lib/test/test_math.py | 18 |
3 files changed, 34 insertions, 2 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 diff --git a/Lib/site.py b/Lib/site.py index 54a7e2b..548aa62 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -527,7 +527,7 @@ def _script(): Exit codes with --user-base or --user-site: 0 - user site directory is enabled - 1 - user site diretory is disabled by user + 1 - user site directory is disabled by user 2 - uses site directory is disabled by super user or for security reasons >2 - unknown error diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 379ff89..ff8db7c 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -369,6 +369,24 @@ class MathTests(unittest.TestCase): self.assertEquals(math.ldexp(NINF, -213), NINF) self.assert_(math.isnan(math.ldexp(NAN, 0))) + # large second argument + for n in [10**5, 10**10, 10**20, 10**40]: + self.assertEquals(math.ldexp(INF, -n), INF) + self.assertEquals(math.ldexp(NINF, -n), NINF) + self.assertEquals(math.ldexp(1., -n), 0.) + self.assertEquals(math.ldexp(-1., -n), -0.) + self.assertEquals(math.ldexp(0., -n), 0.) + self.assertEquals(math.ldexp(-0., -n), -0.) + self.assert_(math.isnan(math.ldexp(NAN, -n))) + + self.assertRaises(OverflowError, math.ldexp, 1., n) + self.assertRaises(OverflowError, math.ldexp, -1., n) + self.assertEquals(math.ldexp(0., n), 0.) + self.assertEquals(math.ldexp(-0., n), -0.) + self.assertEquals(math.ldexp(INF, n), INF) + self.assertEquals(math.ldexp(NINF, n), NINF) + self.assert_(math.isnan(math.ldexp(NAN, n))) + def testLog(self): self.assertRaises(TypeError, math.log) self.ftest('log(1/e)', math.log(1/math.e), -1) |