root/feature.py

Revision 625:aa387d2157b6, 0.8 kB (checked in by Stefan Schwarzer <sschwarzer@…>, 4 weeks ago)
Modules can only be deleted if they've been imported.
Line 
1# encoding: UTF-8
2# Copyright (C) 2010, Stefan Schwarzer
3
4"""
5Determine if the system Websourcebrowser runs on has certain features.
6
7For example, `feature.pygments` tells whether the system has the
8Pygments syntax highlighting package installed and in the module
9search path.
10"""
11
12# Pygments - syntax highlighting
13try:
14    import pygments as pygments_package
15    from pygments import lexers
16    del lexers
17    from pygments import formatters
18    del formatters
19    pygments = True
20except ImportError:
21    pygments = False
22
23
24# Cherrypy - robust multi-threaded server
25try:
26    import cherrypy as cherrypy_package
27except ImportError:
28    cherrypy = False
29else:
30    # Websourcebrowser server is programmed with CherryPy 3.x's API in mind
31    cherrypy = cherrypy_package.__version__.startswith("3.")
32
33
34# Exuberant ctags - class/method/function tree
Note: See TracBrowser for help on using the browser.