To minimize what seems to be an increased risk of segfaults when using virtualenv with system packages, this commit introduces an alternative, which does away with the general system package availability, but adds symlinks to two svn related system packages when running checks.
- Legacy-Id: 12208
This commit is contained in:
parent
4e77d64ac4
commit
17bf44af3c
|
@ -1,7 +1,10 @@
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
|
import debug # pyflakes:ignore
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import checks
|
from django.core import checks
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
|
@ -213,6 +216,19 @@ def check_cache(app_configs, **kwargs):
|
||||||
@checks.register('cache')
|
@checks.register('cache')
|
||||||
def check_svn_import(app_configs, **kwargs):
|
def check_svn_import(app_configs, **kwargs):
|
||||||
errors = []
|
errors = []
|
||||||
|
#
|
||||||
|
site_packages_dir = None
|
||||||
|
for p in sys.path:
|
||||||
|
if ('/env/' in p or '/venv/' in p) and '/site-packages' in p:
|
||||||
|
site_packages_dir = p
|
||||||
|
break
|
||||||
|
if site_packages_dir:
|
||||||
|
for path in settings.SVN_PACKAGES:
|
||||||
|
dir, name = os.path.split(path)
|
||||||
|
package_link = os.path.join(site_packages_dir, name)
|
||||||
|
if not os.path.exists(package_link):
|
||||||
|
os.symlink(path, package_link)
|
||||||
|
#
|
||||||
if settings.SERVER_MODE == 'production':
|
if settings.SERVER_MODE == 'production':
|
||||||
try:
|
try:
|
||||||
import svn # pyflakes:ignore
|
import svn # pyflakes:ignore
|
||||||
|
@ -225,14 +241,15 @@ def check_svn_import(app_configs, **kwargs):
|
||||||
|
|
||||||
However, the subversion bindings seem to be unavailable. The subversion
|
However, the subversion bindings seem to be unavailable. The subversion
|
||||||
bindings are not available for install using pip, but must be supplied by
|
bindings are not available for install using pip, but must be supplied by
|
||||||
the system package manager. In order to be available within a python
|
the system package manager. In order to be available within the python
|
||||||
virtualenv, the virtualenv must have been created with the
|
virtualenv, ietf.checks.check_svn_import() tries to create a symlink from
|
||||||
--system-site-packages flag, so that the packages installed by the system
|
the configured location of the system-provided svn package to the
|
||||||
package manager are visible.
|
site-packages directory of the virtualenv. If you get this message, that has
|
||||||
|
failed to provide the svn package.
|
||||||
|
|
||||||
Please install 'python-subversion' (Debian), 'subversion-python' (RedHat,
|
Please install 'python-subversion' (Debian), 'subversion-python' (RedHat,
|
||||||
CentOS, Fedora), 'subversion-python27bindings' (BSD); and set up a
|
CentOS, Fedora), 'subversion-python27bindings' (BSD); and provide the
|
||||||
virtualenv using the --system-site-packages flag. Further tips are
|
correct path to the svn package in settings.SVN_PACKAGE. Further tips are
|
||||||
available at https://trac.edgewall.org/wiki/TracSubversion.
|
available at https://trac.edgewall.org/wiki/TracSubversion.
|
||||||
|
|
||||||
""").replace('\n', '\n ').rstrip(),
|
""").replace('\n', '\n ').rstrip(),
|
||||||
|
|
|
@ -666,6 +666,10 @@ TRAC_WIKI_URL_PATTERN = "https://trac.ietf.org/trac/%s/wiki"
|
||||||
TRAC_ISSUE_URL_PATTERN = "https://trac.ietf.org/trac/%s/report/1"
|
TRAC_ISSUE_URL_PATTERN = "https://trac.ietf.org/trac/%s/report/1"
|
||||||
TRAC_SVN_DIR_PATTERN = "/a/svn/group/%s"
|
TRAC_SVN_DIR_PATTERN = "/a/svn/group/%s"
|
||||||
TRAC_SVN_URL_PATTERN = "https://svn.ietf.org/svn/group/%s/"
|
TRAC_SVN_URL_PATTERN = "https://svn.ietf.org/svn/group/%s/"
|
||||||
|
SVN_PACKAGES = [
|
||||||
|
"/usr/lib/python2.7/dist-packages/svn",
|
||||||
|
"/usr/lib/python2.7/dist-packages/libsvn",
|
||||||
|
]
|
||||||
|
|
||||||
TRAC_ENV_OPTIONS = [
|
TRAC_ENV_OPTIONS = [
|
||||||
('project', 'name', "{name} Wiki"),
|
('project', 'name', "{name} Wiki"),
|
||||||
|
|
Loading…
Reference in a new issue