|
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 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | """ |
|---|
| 5 | Determine if the system Websourcebrowser runs on has certain features. |
|---|
| 6 | |
|---|
| 7 | For example, `feature.pygments` tells whether the system has the |
|---|
| 8 | Pygments syntax highlighting package installed and in the module |
|---|
| 9 | search path. |
|---|
| 10 | """ |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | try: |
|---|
| 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 |
|---|
| 20 | except ImportError: |
|---|
| 21 | pygments = False |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | try: |
|---|
| 26 | import cherrypy as cherrypy_package |
|---|
| 27 | except ImportError: |
|---|
| 28 | cherrypy = False |
|---|
| 29 | else: |
|---|
| 30 | |
|---|
| 31 | cherrypy = cherrypy_package.__version__.startswith("3.") |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|