ENH: until we make it proper module -- adjust sys.path only if system-wide run

_tent/ipv6_adapter_cmd^2
Yaroslav Halchenko 2012-11-09 08:57:33 -05:00
parent 348239cf14
commit 9e7a3b7a04
3 changed files with 9 additions and 3 deletions

View File

@ -33,7 +33,9 @@ import getopt, time, shlex, socket
# Inserts our own modules path first in the list
# fix for bug #343821
sys.path.insert(1, "/usr/share/fail2ban")
if os.path.abspath(__file__).startswith('/usr/'):
# makes sense to use system-wide library iff -client is also under /usr/
sys.path.insert(1, "/usr/share/fail2ban")
# Now we can import our modules
from common.version import version

View File

@ -29,7 +29,9 @@ import getopt, sys, time, logging, os
# Inserts our own modules path first in the list
# fix for bug #343821
sys.path.insert(1, "/usr/share/fail2ban")
if os.path.abspath(__file__).startswith('/usr/'):
# makes sense to use system-wide library iff -regex is also under /usr/
sys.path.insert(1, "/usr/share/fail2ban")
from client.configparserinc import SafeConfigParserWithIncludes
from ConfigParser import NoOptionError, NoSectionError, MissingSectionHeaderError

View File

@ -32,7 +32,9 @@ import getopt, sys, logging
# Inserts our own modules path first in the list
# fix for bug #343821
sys.path.insert(1, "/usr/share/fail2ban")
if os.path.abspath(__file__).startswith('/usr/'):
# makes sense to use system-wide library iff -server is also under /usr/
sys.path.insert(1, "/usr/share/fail2ban")
from common.version import version
from server.server import Server