Skip to content

Commit ef9bf2f

Browse files
committed
Added a system check to ensure that the svn bindings are available when running in production mode.
- Legacy-Id: 12177
1 parent f33eab6 commit ef9bf2f

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

ietf/checks.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import time
3+
from textwrap import dedent
34

45
from django.conf import settings
56
from django.core import checks
@@ -209,3 +210,32 @@ def cache_error(msg, errnum):
209210
errors.append(cache_error("Cache didn't accept session cookie age", "E0016"))
210211
return errors
211212

213+
@checks.register('cache')
214+
def check_svn_import(app_configs, **kwargs):
215+
errors = []
216+
if settings.SERVER_MODE == 'production':
217+
try:
218+
import svn # pyflakes:ignore
219+
except ImportError as e:
220+
errors.append(checks.Critical(
221+
"Could not import the python svn module:\n %s\n" % e,
222+
hint = dedent("""
223+
You are running in production mode, and the subversion bindings for python
224+
are necessary in order to run the Trac wiki glue scripts.
225+
226+
However, the subversion bindings seem to be unavailable. The subversion
227+
bindings are not available for install using pip, but must be supplied by
228+
the system package manager. In order to be available within a python
229+
virtualenv, the virtualenv must have been created with the
230+
--system-site-packages flag, so that the packages installed by the system
231+
package manager are visible.
232+
233+
Please install 'python-subversion' (Debian), 'subversion-python' (RedHat,
234+
CentOS, Fedora), 'subversion-python27bindings' (BSD); and set up a
235+
virtualenv using the --system-site-packages flag. Further tips are
236+
available at https://trac.edgewall.org/wiki/TracSubversion.
237+
238+
""").replace('\n', '\n ').rstrip(),
239+
id = "datatracker.E0014",
240+
))
241+
return errors

0 commit comments

Comments
 (0)