You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
5.1 KiB
153 lines
5.1 KiB
From 3965d690b137152b2a0a6a46989178b5566cfd8e Mon Sep 17 00:00:00 2001
|
|
From: Angelo Compagnucci <angelo@amarulasolutions.com>
|
|
Date: Thu, 16 Jan 2020 12:05:13 +0100
|
|
Subject: [PATCH 1/2] Revert "setup.py: adding option to install without tests"
|
|
|
|
Test should actually removed from the stup data in finalize_options
|
|
instead of being added back.
|
|
|
|
This reverts commit 9b918bba2f672780fb4469294d80ba7deb6b8cab.
|
|
|
|
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
|
|
---
|
|
setup.py | 41 ++++++++++++++++-------------------------
|
|
1 file changed, 16 insertions(+), 25 deletions(-)
|
|
|
|
diff --git a/setup.py b/setup.py
|
|
index e476c5dd6..8da292683 100755
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -119,11 +119,9 @@ def update_scripts(self, dry_run=False):
|
|
class install_command_f2b(install):
|
|
user_options = install.user_options + [
|
|
('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):
|
|
self.disable_2to3 = None
|
|
- self.without_tests = None
|
|
install.initialize_options(self)
|
|
def finalize_options(self):
|
|
global _2to3
|
|
@@ -134,28 +132,6 @@ def finalize_options(self):
|
|
cmdclass = self.distribution.cmdclass
|
|
cmdclass['build_py'] = build_py_2to3
|
|
cmdclass['build_scripts'] = build_scripts_2to3
|
|
- if not self.without_tests:
|
|
- self.distribution.scripts += [
|
|
- 'bin/fail2ban-testcases',
|
|
- ]
|
|
-
|
|
- self.distribution.packages += [
|
|
- 'fail2ban.tests',
|
|
- 'fail2ban.tests.action_d',
|
|
- ]
|
|
-
|
|
- self.distribution.package_data = {
|
|
- 'fail2ban.tests':
|
|
- [ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
|
- for w in os.walk('fail2ban/tests/files')
|
|
- for f in w[2]] +
|
|
- [ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
|
- for w in os.walk('fail2ban/tests/config')
|
|
- for f in w[2]] +
|
|
- [ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
|
- for w in os.walk('fail2ban/tests/action_d')
|
|
- for f in w[2]]
|
|
- }
|
|
install.finalize_options(self)
|
|
def run(self):
|
|
install.run(self)
|
|
@@ -232,20 +208,35 @@ def run(self):
|
|
license = "GPL",
|
|
platforms = "Posix",
|
|
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
|
|
},
|
|
scripts = [
|
|
'bin/fail2ban-client',
|
|
'bin/fail2ban-server',
|
|
'bin/fail2ban-regex',
|
|
+ 'bin/fail2ban-testcases',
|
|
# 'bin/fail2ban-python', -- link (binary), will be installed via install_scripts_f2b wrapper
|
|
],
|
|
packages = [
|
|
'fail2ban',
|
|
'fail2ban.client',
|
|
'fail2ban.server',
|
|
+ 'fail2ban.tests',
|
|
+ 'fail2ban.tests.action_d',
|
|
],
|
|
+ package_data = {
|
|
+ 'fail2ban.tests':
|
|
+ [ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
|
+ for w in os.walk('fail2ban/tests/files')
|
|
+ for f in w[2]] +
|
|
+ [ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
|
+ for w in os.walk('fail2ban/tests/config')
|
|
+ for f in w[2]] +
|
|
+ [ join(w[0], f).replace("fail2ban/tests/", "", 1)
|
|
+ for w in os.walk('fail2ban/tests/action_d')
|
|
+ for f in w[2]]
|
|
+ },
|
|
data_files = [
|
|
('/etc/fail2ban',
|
|
glob("config/*.conf")
|
|
|
|
From 5fa1f69264d3c23793f64c03c96737d54555e919 Mon Sep 17 00:00:00 2001
|
|
From: Angelo Compagnucci <angelo@amarulasolutions.com>
|
|
Date: Thu, 16 Jan 2020 12:28:42 +0100
|
|
Subject: [PATCH 2/2] setup.py: adding option to install without tests
|
|
|
|
Tests files are not always needed especially when installing on low
|
|
resource systems like an embedded one.
|
|
This patch adds the --without-tests option to skip installing the
|
|
tests files.
|
|
|
|
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
|
|
---
|
|
setup.py | 11 ++++++++++-
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/setup.py b/setup.py
|
|
index 8da292683..ce1eedf68 100755
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -119,9 +119,11 @@ def update_scripts(self, dry_run=False):
|
|
class install_command_f2b(install):
|
|
user_options = install.user_options + [
|
|
('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):
|
|
self.disable_2to3 = None
|
|
+ self.without_tests = None
|
|
install.initialize_options(self)
|
|
def finalize_options(self):
|
|
global _2to3
|
|
@@ -132,6 +134,13 @@ def finalize_options(self):
|
|
cmdclass = self.distribution.cmdclass
|
|
cmdclass['build_py'] = build_py_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)
|
|
def run(self):
|
|
install.run(self)
|
|
@@ -208,7 +217,7 @@ def run(self):
|
|
license = "GPL",
|
|
platforms = "Posix",
|
|
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
|
|
},
|
|
scripts = [
|