mirror of https://github.com/fail2ban/fail2ban
setup.py: cherry-pick from 0.11 (option --without-tests)
parent
9c8dcbd6eb
commit
a107a8e7d2
29
setup.py
29
setup.py
|
@ -63,6 +63,8 @@ source_dir = os.path.realpath(os.path.dirname(
|
||||||
sys.argv[0] if os.path.basename(sys.argv[0]) == 'setup.py' else __file__
|
sys.argv[0] if os.path.basename(sys.argv[0]) == 'setup.py' else __file__
|
||||||
))
|
))
|
||||||
|
|
||||||
|
with_tests = True
|
||||||
|
|
||||||
# Wrapper to install python binding (to current python version):
|
# Wrapper to install python binding (to current python version):
|
||||||
class install_scripts_f2b(install_scripts):
|
class install_scripts_f2b(install_scripts):
|
||||||
|
|
||||||
|
@ -119,9 +121,11 @@ class install_scripts_f2b(install_scripts):
|
||||||
class install_command_f2b(install):
|
class install_command_f2b(install):
|
||||||
user_options = install.user_options + [
|
user_options = install.user_options + [
|
||||||
('disable-2to3', None, 'Specify to deactivate 2to3, e.g. if the install runs from fail2ban test-cases.'),
|
('disable-2to3', None, 'Specify to deactivate 2to3, e.g. if the install runs from fail2ban test-cases.'),
|
||||||
|
('without-tests', None, 'without tests files installation'),
|
||||||
]
|
]
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
self.disable_2to3 = None
|
self.disable_2to3 = None
|
||||||
|
self.without_tests = not with_tests
|
||||||
install.initialize_options(self)
|
install.initialize_options(self)
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
global _2to3
|
global _2to3
|
||||||
|
@ -132,6 +136,13 @@ class install_command_f2b(install):
|
||||||
cmdclass = self.distribution.cmdclass
|
cmdclass = self.distribution.cmdclass
|
||||||
cmdclass['build_py'] = build_py_2to3
|
cmdclass['build_py'] = build_py_2to3
|
||||||
cmdclass['build_scripts'] = build_scripts_2to3
|
cmdclass['build_scripts'] = build_scripts_2to3
|
||||||
|
if self.without_tests:
|
||||||
|
self.distribution.scripts.remove('bin/fail2ban-testcases')
|
||||||
|
|
||||||
|
self.distribution.packages.remove('fail2ban.tests')
|
||||||
|
self.distribution.packages.remove('fail2ban.tests.action_d')
|
||||||
|
|
||||||
|
del self.distribution.package_data['fail2ban.tests']
|
||||||
install.finalize_options(self)
|
install.finalize_options(self)
|
||||||
def run(self):
|
def run(self):
|
||||||
install.run(self)
|
install.run(self)
|
||||||
|
@ -159,6 +170,12 @@ elif "test" in sys.argv:
|
||||||
print("python distribute required to execute fail2ban tests")
|
print("python distribute required to execute fail2ban tests")
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
# if build without tests:
|
||||||
|
if "build" in sys.argv:
|
||||||
|
if "--without-tests" in sys.argv:
|
||||||
|
with_tests = False
|
||||||
|
sys.argv.remove("--without-tests")
|
||||||
|
|
||||||
longdesc = '''
|
longdesc = '''
|
||||||
Fail2Ban scans log files like /var/log/pwdfail or
|
Fail2Ban scans log files like /var/log/pwdfail or
|
||||||
/var/log/apache/error_log and bans IP that makes
|
/var/log/apache/error_log and bans IP that makes
|
||||||
|
@ -208,23 +225,25 @@ setup(
|
||||||
license = "GPL",
|
license = "GPL",
|
||||||
platforms = "Posix",
|
platforms = "Posix",
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
'build_py': build_py, 'build_scripts': build_scripts,
|
'build_py': build_py, 'build_scripts': build_scripts,
|
||||||
'install_scripts': install_scripts_f2b, 'install': install_command_f2b
|
'install_scripts': install_scripts_f2b, 'install': install_command_f2b
|
||||||
},
|
},
|
||||||
scripts = [
|
scripts = [
|
||||||
'bin/fail2ban-client',
|
'bin/fail2ban-client',
|
||||||
'bin/fail2ban-server',
|
'bin/fail2ban-server',
|
||||||
'bin/fail2ban-regex',
|
'bin/fail2ban-regex',
|
||||||
'bin/fail2ban-testcases',
|
|
||||||
# 'bin/fail2ban-python', -- link (binary), will be installed via install_scripts_f2b wrapper
|
# 'bin/fail2ban-python', -- link (binary), will be installed via install_scripts_f2b wrapper
|
||||||
],
|
] + [
|
||||||
|
'bin/fail2ban-testcases',
|
||||||
|
] if with_tests else [],
|
||||||
packages = [
|
packages = [
|
||||||
'fail2ban',
|
'fail2ban',
|
||||||
'fail2ban.client',
|
'fail2ban.client',
|
||||||
'fail2ban.server',
|
'fail2ban.server',
|
||||||
|
] + [
|
||||||
'fail2ban.tests',
|
'fail2ban.tests',
|
||||||
'fail2ban.tests.action_d',
|
'fail2ban.tests.action_d',
|
||||||
],
|
] if with_tests else [],
|
||||||
package_data = {
|
package_data = {
|
||||||
'fail2ban.tests':
|
'fail2ban.tests':
|
||||||
[ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
[ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
||||||
|
@ -236,7 +255,7 @@ setup(
|
||||||
[ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
[ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
||||||
for w in os.walk('fail2ban/tests/action_d')
|
for w in os.walk('fail2ban/tests/action_d')
|
||||||
for f in w[2]]
|
for f in w[2]]
|
||||||
},
|
} if with_tests else {},
|
||||||
data_files = [
|
data_files = [
|
||||||
('/etc/fail2ban',
|
('/etc/fail2ban',
|
||||||
glob("config/*.conf")
|
glob("config/*.conf")
|
||||||
|
|
Loading…
Reference in New Issue