diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-12-15 21:12:38 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-12-15 21:12:38 +0200 |
commit | a71332002adabe8fdb7536c96da00d40b630cdf2 (patch) | |
tree | c7647358e4167eb2f9e01c558e9612eada2d22ec | |
parent | 60a5a783e164d9095bccdbf787c6ff01ca8176e0 (diff) | |
download | astroid-git-a71332002adabe8fdb7536c96da00d40b630cdf2.tar.gz |
Move code which doesn't trigger DistutilsPlatformError outside of the try block.
-rw-r--r-- | astroid/modutils.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/astroid/modutils.py b/astroid/modutils.py index 14c53b3a..ec86010d 100644 --- a/astroid/modutils.py +++ b/astroid/modutils.py @@ -71,22 +71,23 @@ try: # Take care of installations where exec_prefix != prefix. get_python_lib(standard_lib=True, prefix=sys.exec_prefix), get_python_lib(standard_lib=True)]) - if os.name == 'nt': - STD_LIB_DIRS.add(os.path.join(sys.prefix, 'dlls')) - try: - # real_prefix is defined when running inside virtualenv. - STD_LIB_DIRS.add(os.path.join(sys.real_prefix, 'dlls')) - except AttributeError: - pass - if platform.python_implementation() == 'PyPy': - _root = os.path.join(sys.prefix, 'lib_pypy') - STD_LIB_DIRS.add(_root) - del _root # get_python_lib(standard_lib=1) is not available on pypy, set STD_LIB_DIR to # non-valid path, see https://bugs.pypy.org/issue1164 except DistutilsPlatformError: STD_LIB_DIRS = set() +if os.name == 'nt': + STD_LIB_DIRS.add(os.path.join(sys.prefix, 'dlls')) + try: + # real_prefix is defined when running inside virtualenv. + STD_LIB_DIRS.add(os.path.join(sys.real_prefix, 'dlls')) + except AttributeError: + pass +if platform.python_implementation() == 'PyPy': + _root = os.path.join(sys.prefix, 'lib_pypy') + STD_LIB_DIRS.add(_root) + del _root + EXT_LIB_DIR = get_python_lib() IS_JYTHON = platform.python_implementation() == 'Jython' BUILTIN_MODULES = dict.fromkeys(sys.builtin_module_names, True) |