mirror of https://github.com/fail2ban/fail2ban
Merge branch '0.10' into 0.11
commit
95f29f457a
|
@ -12,9 +12,10 @@ python:
|
||||||
- 3.4
|
- 3.4
|
||||||
- 3.5
|
- 3.5
|
||||||
- 3.6
|
- 3.6
|
||||||
|
- 3.7-dev
|
||||||
# disabled since setuptools dropped support for Python 3.0 - 3.2
|
# disabled since setuptools dropped support for Python 3.0 - 3.2
|
||||||
# - pypy3
|
# - pypy3
|
||||||
- pypy3.3-5.2-alpha1
|
- pypy3.3-5.5-alpha
|
||||||
before_install:
|
before_install:
|
||||||
- echo "running under $TRAVIS_PYTHON_VERSION"
|
- echo "running under $TRAVIS_PYTHON_VERSION"
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION == 2* || $TRAVIS_PYTHON_VERSION == pypy* && $TRAVIS_PYTHON_VERSION != pypy3* ]]; then export F2B_PY_2=true && echo "Set F2B_PY_2"; fi
|
- if [[ $TRAVIS_PYTHON_VERSION == 2* || $TRAVIS_PYTHON_VERSION == pypy* && $TRAVIS_PYTHON_VERSION != pypy3* ]]; then export F2B_PY_2=true && echo "Set F2B_PY_2"; fi
|
||||||
|
|
|
@ -121,6 +121,7 @@ class SetupTest(unittest.TestCase):
|
||||||
if not self.setup:
|
if not self.setup:
|
||||||
return # if verbose skip didn't work out
|
return # if verbose skip didn't work out
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
|
remove_build = not os.path.exists('build')
|
||||||
# suppress stdout (and stderr) if not heavydebug
|
# suppress stdout (and stderr) if not heavydebug
|
||||||
supdbgout = ' >/dev/null' if unittest.F2B.log_level >= logging.DEBUG else '' # HEAVYDEBUG
|
supdbgout = ' >/dev/null' if unittest.F2B.log_level >= logging.DEBUG else '' # HEAVYDEBUG
|
||||||
try:
|
try:
|
||||||
|
@ -178,6 +179,8 @@ class SetupTest(unittest.TestCase):
|
||||||
# remove build directory
|
# remove build directory
|
||||||
os.system("%s %s clean --all%s"
|
os.system("%s %s clean --all%s"
|
||||||
% (sys.executable, self.setup, (supdbgout + ' 2>&1') if supdbgout else ''))
|
% (sys.executable, self.setup, (supdbgout + ' 2>&1') if supdbgout else ''))
|
||||||
|
if remove_build and os.path.exists('build'):
|
||||||
|
shutil.rmtree('build')
|
||||||
|
|
||||||
|
|
||||||
class TestsUtilsTest(LogCaptureTestCase):
|
class TestsUtilsTest(LogCaptureTestCase):
|
||||||
|
|
12
setup.py
12
setup.py
|
@ -88,7 +88,15 @@ class install_scripts_f2b(install_scripts):
|
||||||
|
|
||||||
def update_scripts(self, dry_run=False):
|
def update_scripts(self, dry_run=False):
|
||||||
buildroot = os.path.dirname(self.build_dir)
|
buildroot = os.path.dirname(self.build_dir)
|
||||||
print('Creating %s/fail2ban.service (from fail2ban.service.in): @BINDIR@ -> %s' % (buildroot, self.install_dir))
|
install_dir = self.install_dir
|
||||||
|
try:
|
||||||
|
# remove root-base from install scripts path:
|
||||||
|
root = self.distribution.command_options['install']['root'][1]
|
||||||
|
if install_dir.startswith(root):
|
||||||
|
install_dir = install_dir[len(root):]
|
||||||
|
except: # pragma: no cover
|
||||||
|
print('WARNING: Cannot find root-base option, check the bin-path to fail2ban-scripts in "fail2ban.service".')
|
||||||
|
print('Creating %s/fail2ban.service (from fail2ban.service.in): @BINDIR@ -> %s' % (buildroot, install_dir))
|
||||||
with open(os.path.join(source_dir, 'files/fail2ban.service.in'), 'r') as fn:
|
with open(os.path.join(source_dir, 'files/fail2ban.service.in'), 'r') as fn:
|
||||||
lines = fn.readlines()
|
lines = fn.readlines()
|
||||||
fn = None
|
fn = None
|
||||||
|
@ -96,7 +104,7 @@ class install_scripts_f2b(install_scripts):
|
||||||
fn = open(os.path.join(buildroot, 'fail2ban.service'), 'w')
|
fn = open(os.path.join(buildroot, 'fail2ban.service'), 'w')
|
||||||
try:
|
try:
|
||||||
for ln in lines:
|
for ln in lines:
|
||||||
ln = re.sub(r'@BINDIR@', lambda v: self.install_dir, ln)
|
ln = re.sub(r'@BINDIR@', lambda v: install_dir, ln)
|
||||||
if dry_run:
|
if dry_run:
|
||||||
sys.stdout.write(' | ' + ln)
|
sys.stdout.write(' | ' + ln)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue