11import os
2+ import sys
23import time
34from textwrap import dedent
45
6+ import debug # pyflakes:ignore
7+
58from django .conf import settings
69from django .core import checks
710from django .utils .module_loading import import_string
@@ -213,6 +216,19 @@ def cache_error(msg, errnum):
213216@checks .register ('cache' )
214217def check_svn_import (app_configs , ** kwargs ):
215218 errors = []
219+ #
220+ site_packages_dir = None
221+ for p in sys .path :
222+ if ('/env/' in p or '/venv/' in p ) and '/site-packages' in p :
223+ site_packages_dir = p
224+ break
225+ if site_packages_dir :
226+ for path in settings .SVN_PACKAGES :
227+ dir , name = os .path .split (path )
228+ package_link = os .path .join (site_packages_dir , name )
229+ if not os .path .exists (package_link ):
230+ os .symlink (path , package_link )
231+ #
216232 if settings .SERVER_MODE == 'production' :
217233 try :
218234 import svn # pyflakes:ignore
@@ -225,14 +241,15 @@ def check_svn_import(app_configs, **kwargs):
225241
226242 However, the subversion bindings seem to be unavailable. The subversion
227243 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.
244+ the system package manager. In order to be available within the python
245+ virtualenv, ietf.checks.check_svn_import() tries to create a symlink from
246+ the configured location of the system-provided svn package to the
247+ site-packages directory of the virtualenv. If you get this message, that has
248+ failed to provide the svn package.
232249
233250 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
251+ CentOS, Fedora), 'subversion-python27bindings' (BSD); and provide the
252+ correct path to the svn package in settings.SVN_PACKAGE . Further tips are
236253 available at https://trac.edgewall.org/wiki/TracSubversion.
237254
238255 """ ).replace ('\n ' , '\n ' ).rstrip (),
0 commit comments