This repository has been archived by the owner on Mar 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
setup.py
executable file
·118 lines (93 loc) · 3.78 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004, 2005, 2006 Juan M. Bello Rivas <jmbr@superadditive.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
D = os.path.join
from distutils.core import setup, Command
import Halberd.ScanTask
from Halberd.version import version
class test(Command):
"""Automated testing.
Based upon:
http://mail.python.org/pipermail/distutils-sig/2002-January/002714.html
"""
description = "test the distribution prior to install"
user_options = [
('test-dir=', None, "directory that contains the test definitions"),
]
def initialize_options(self):
self.test_dir = 'tests'
def finalize_options(self):
build = self.get_finalized_command('build')
self.build_purelib = build.build_purelib
self.build_platlib = build.build_platlib
def run(self):
import sys
import unittest
self.run_command('build')
self.run_command('build_ext')
# remember old sys.path to restore it afterwards
old_path = sys.path[:]
# extend sys.path
sys.path.insert(0, self.build_purelib)
sys.path.insert(0, self.build_platlib)
sys.path.insert(0, D(os.getcwd(), self.test_dir))
modules = [test[:-3] for test in os.listdir(self.test_dir) \
if test.startswith('test_') and test.endswith('.py')]
loader = unittest.TestLoader()
runner = unittest.TextTestRunner(verbosity=2)
for module in modules:
print "Running tests found in '%s'..." % module
TEST = __import__(module, globals(), locals(), [])
suite = loader.loadTestsFromModule(TEST)
runner.run(suite)
# restore sys.path
sys.path = old_path[:]
long_description = \
r"""Halberd discovers HTTP load balancers. It is useful for web application security auditing
and for load balancer configuration testing."""
# Trove classifiers. The complete list can be grabbed from:
# http://www.python.org/pypi?:action=list_classifiers
classifiers = """\
Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Developers
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: GNU General Public License (GPL)
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python
Topic :: Internet :: WWW/HTTP
Topic :: Security
"""
setup(
name = 'halberd', version = version.v_short,
description = 'HTTP load balancer detector',
long_description = long_description,
author = 'Juan M. Bello Rivas',
author_email = 'jmbr@superadditive.com',
url = 'http://halberd.superadditive.com/',
packages = ['Halberd', 'Halberd.clues'],
package_dir = {'Halberd': 'Halberd'},
scripts = [D('scripts', 'halberd')],
data_files = [(D('man', 'man1'), \
[D('man', 'man1', 'halberd.1')])],
classifiers = classifiers.splitlines(),
cmdclass = {'test': test},
)
# vim: ts=4 sw=4 et