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.)

This commit is contained in:
sebres
2016-08-12 16:41:55 +02:00
parent f390a82b59
commit c8e7c1f7f4
2 changed files with 10 additions and 2 deletions

View File

@@ -66,7 +66,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