comparison MoinMoin/_tests/ldap_testbase.py @ 4617:8a3c0c726d66

remove some references to py 2.3/2.4 - 2.4 is the minimum now anyway
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 01 Mar 2009 04:11:08 +0100
parents 07862b0663fd
children
comparison
equal deleted inserted replaced
4616:995e39af3f7c 4617:8a3c0c726d66
30 On Ubuntu 8.04 there is apparmor imposing some restrictions on /usr/sbin/slapd, 30 On Ubuntu 8.04 there is apparmor imposing some restrictions on /usr/sbin/slapd,
31 so you need to disable apparmor by invoking this as root: 31 so you need to disable apparmor by invoking this as root:
32 32
33 # /etc/init.d/apparmor stop 33 # /etc/init.d/apparmor stop
34 34
35 Requires Python 2.4 (for subprocess module).
36
37 @copyright: 2008 by Thomas Waldmann 35 @copyright: 2008 by Thomas Waldmann
38 @license: GNU GPL, see COPYING for details. 36 @license: GNU GPL, see COPYING for details.
39 """ 37 """
40 38
41 SLAPD_EXECUTABLE = 'slapd' # filename of LDAP server executable - if it is not 39 SLAPD_EXECUTABLE = 'slapd' # filename of LDAP server executable - if it is not
42 # in your PATH, you have to give full path/filename. 40 # in your PATH, you have to give full path/filename.
43 41
44 import os, shutil, tempfile, time, base64, md5 42 import os, shutil, tempfile, time, base64, md5
45 from StringIO import StringIO 43 from StringIO import StringIO
46 import signal 44 import signal
47 45 import subprocess
48 try:
49 import subprocess # needs Python 2.4
50 except ImportError:
51 subprocess = None
52 46
53 try: 47 try:
54 import ldap, ldif, ldap.modlist # needs python-ldap 48 import ldap, ldif, ldap.modlist # needs python-ldap
55 except ImportError: 49 except ImportError:
56 ldap = None 50 ldap = None
59 def check_environ(): 53 def check_environ():
60 """ Check the system environment whether we are able to run. 54 """ Check the system environment whether we are able to run.
61 Either return some failure reason if we can't or None if everything 55 Either return some failure reason if we can't or None if everything
62 looks OK. 56 looks OK.
63 """ 57 """
64 if subprocess is None:
65 return "You need at least python 2.4 to use ldap_testbase."
66 if ldap is None: 58 if ldap is None:
67 return "You need python-ldap installed to use ldap_testbase." 59 return "You need python-ldap installed to use ldap_testbase."
68 slapd = False 60 slapd = False
69 try: 61 try:
70 p = subprocess.Popen([SLAPD_EXECUTABLE, '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 62 p = subprocess.Popen([SLAPD_EXECUTABLE, '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)