mirror of https://github.com/fail2ban/fail2ban
BF: prefer sys.argv[0] by retrieving of root resp. bin path: __file__ seems to be overwritten sometimes on some python versions (e.g. bug of 2.6 by running under cProfile, etc.)
parent
6cdc1ce685
commit
db30b7ce06
|
@ -45,7 +45,11 @@ from fail2ban.server.mytime import MyTime
|
|||
from optparse import OptionParser, Option
|
||||
|
||||
# Update fail2ban-python env to current python version (where f2b-modules located/installed)
|
||||
updatePyExec(os.path.dirname(__file__))
|
||||
bindir = os.path.dirname(
|
||||
# __file__ seems to be overwritten sometimes on some python versions (e.g. bug of 2.6 by running under cProfile, etc.):
|
||||
sys.argv[0] if os.path.basename(sys.argv[0]) == 'fail2ban-testcases' else __file__
|
||||
)
|
||||
updatePyExec(bindir)
|
||||
|
||||
def get_opt_parser():
|
||||
# use module docstring for help output
|
||||
|
|
6
setup.py
6
setup.py
|
@ -68,7 +68,11 @@ class install_scripts_f2b(install_scripts):
|
|||
|
||||
|
||||
# Update fail2ban-python env to current python version (where f2b-modules located/installed)
|
||||
updatePyExec(os.path.join(os.path.dirname(__file__), 'bin'))
|
||||
rootdir = os.path.realpath(os.path.dirname(
|
||||
# __file__ seems to be overwritten sometimes on some python versions (e.g. bug of 2.6 by running under cProfile, etc.):
|
||||
sys.argv[0] if os.path.basename(sys.argv[0]) == 'setup.py' else __file__
|
||||
))
|
||||
updatePyExec(os.path.join(rootdir, 'bin'))
|
||||
|
||||
if setuptools and "test" in sys.argv:
|
||||
import logging
|
||||
|
|
Loading…
Reference in New Issue