# Add a minimal library (with spyderlib) at the end of sys.path to
        # be able to connect our monitor to the external console
        app_pythonpath = 'Spyder.app/Contents/Resources/lib/python2.7'
        full_pythonpath = [p for p in sys.path if p.endswith(app_pythonpath)]
        if full_pythonpath:
            sys.path.remove(full_pythonpath[0])
            sys.path.append(full_pythonpath[0] + osp.sep + 'minimal-lib')
    else:
        # Add missing variables and methods to the app's site module
        import site
        import osx_app_site
        osx_app_site.setcopyright()
        osx_app_site.sethelper()
        site._Printer = osx_app_site._Printer
        site.USER_BASE = osx_app_site.getuserbase()
        site.USER_SITE = osx_app_site.getusersitepackages()


mpl_backend = os.environ.get("MATPLOTLIB_BACKEND")
if mpl_backend:
    try:
        import matplotlib
        if os.environ.get('QT_API') == 'pyside':
            # Try to address PySide lack of an input hook on Mac by settting
            # mpl_backend to always be MacOSX
            # Fixes Issue 347
            if mpl_backend == 'Qt4Agg' and sys.platform == 'darwin':
                mpl_backend = 'MacOSX'
        matplotlib.rcParams['docstring.hardcopy'] = True
        matplotlib.use(mpl_backend)
    except ImportError:
Exemple #2
0
                MAC_APP_NAME, py_ver)
            full_pythonpath = [
                p for p in sys.path if p.endswith(app_pythonpath)
            ]
            if full_pythonpath:
                sys.path.remove(full_pythonpath[0])
                sys.path.append(full_pythonpath[0] + osp.sep + 'minimal-lib')
        else:
            # Add missing variables and methods to the app's site module
            import site
            import osx_app_site
            osx_app_site.setcopyright()
            osx_app_site.sethelper()
            site._Printer = osx_app_site._Printer
            site.USER_BASE = osx_app_site.getuserbase()
            site.USER_SITE = osx_app_site.getusersitepackages()

#==============================================================================
# Importing user's sitecustomize
#==============================================================================
try:
    import sitecustomize  #analysis:ignore
except ImportError:
    pass

#==============================================================================
# Add default filesystem encoding on Linux to avoid an error with
# Matplotlib 1.5 in Python 2 (Fixes Issue 2793)
#==============================================================================
if PY2 and sys.platform.startswith('linux'):