diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2010-09-20 10:13:13 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2010-09-20 10:13:13 (GMT) |
commit | 61c3f0dae732589b11f4a1a2cb26173fe0fb5983 (patch) | |
tree | a17def55012ad4ce8a49c5946936c5734764b4a5 /Lib | |
parent | bb14d4bc173559dced0f69fb0b8a43a0594f75f8 (diff) | |
download | cpython-61c3f0dae732589b11f4a1a2cb26173fe0fb5983.zip cpython-61c3f0dae732589b11f4a1a2cb26173fe0fb5983.tar.gz cpython-61c3f0dae732589b11f4a1a2cb26173fe0fb5983.tar.bz2 |
logging: added hasHandlers() to LoggerAdapter.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/sysconfig.py | 26 | ||||
-rw-r--r-- | Lib/logging/__init__.py | 6 | ||||
-rw-r--r-- | Lib/sysconfig.py | 3 |
3 files changed, 23 insertions, 12 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 48f3fe4..3567db8 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -56,6 +56,18 @@ def get_python_version(): """ return sys.version[:3] +def _get_build_dir(name, plat_specific): + # Assume the executable is in the build directory. The + # pyconfig.h file should be in the same directory. Since + # the build directory may not be the source directory, we + # must use "srcdir" from the makefile to find the "Include" + # directory. + base = os.path.dirname(os.path.abspath(sys.executable)) + if plat_specific: + return base + else: + thedir = os.path.join(get_config_var('srcdir'), name) + return os.path.normpath(thedir) def get_python_inc(plat_specific=0, prefix=None): """Return the directory containing installed Python header files. @@ -72,17 +84,7 @@ def get_python_inc(plat_specific=0, prefix=None): prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": if python_build: - # Assume the executable is in the build directory. The - # pyconfig.h file should be in the same directory. Since - # the build directory may not be the source directory, we - # must use "srcdir" from the makefile to find the "Include" - # directory. - base = os.path.dirname(os.path.abspath(sys.executable)) - if plat_specific: - return base - else: - incdir = os.path.join(get_config_var('srcdir'), 'Include') - return os.path.normpath(incdir) + return _get_build_dir('Include', plat_specific) return os.path.join(prefix, "include", "python" + get_python_version()) elif os.name == "nt": return os.path.join(prefix, "include") @@ -117,6 +119,8 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": + if python_build: + return _get_build_dir('Lib', plat_specific) libpython = os.path.join(prefix, "lib", "python" + get_python_version()) if standard_lib: diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 134d923..42b957c 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1439,6 +1439,12 @@ class LoggerAdapter(object): """ return self.logger.isEnabledFor(level) + def hasHandlers(self): + """ + See if the underlying logger has any handlers. + """ + return self.logger.hasHandlers() + root = RootLogger(WARNING) Logger.root = root Logger.manager = Manager(Logger.root) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index 147bd6d..7372e3e 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -123,8 +123,9 @@ _PYTHON_BUILD = is_python_build() if _PYTHON_BUILD: for scheme in ('posix_prefix', 'posix_home'): - _INSTALL_SCHEMES[scheme]['include'] = '{srcdir}/Include' + _INSTALL_SCHEMES[scheme]['include'] = '{projectbase}/Include' _INSTALL_SCHEMES[scheme]['platinclude'] = '{projectbase}/.' + _INSTALL_SCHEMES[scheme]['stdlib'] = '{projectbase}/Lib' def _subst_vars(s, local_vars): try: |