forked from ffalcinelli/pydivert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
147 lines (117 loc) · 4.93 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Fabio Falcinelli
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
import os
import site
from pydivert.decorators import cd
from pydivert.install import WinDivertInstaller
__author__ = 'fabio'
from setuptools import setup, find_packages, Command
from setuptools.command.install import install as _install
workdir = os.path.abspath(os.path.dirname(__file__))
windivert = {
"version": "1.1.7",
"compiler": "WDDK", # MSVC | MINGW
"url": "https://github.com/basil00/Divert/releases/download/v%(version)s/WinDivert-%(version)s-%(compiler)s.zip"
}
class install(_install):
description = 'Installs pydivert package and the windivert driver'
def run(self):
windivert_installer = WinDivertInstaller(windivert)
_install.run(self)
self.execute(windivert_installer.run, (self.install_lib,),
msg="Running WinDivert install task")
class InstallDriver(Command):
description = 'Installs the windivert driver'
user_options = []
extra_env = {}
extra_args = []
def run(self):
windivert_installer = WinDivertInstaller(windivert)
self.execute(windivert_installer.run, (site.getsitepackages()[0],),
msg="Running WinDivert uninstall task")
def initialize_options(self):
pass
def finalize_options(self):
pass
class UninstallDriver(Command):
description = 'Uninstalls the windivert driver'
user_options = []
extra_env = {}
extra_args = []
def run(self):
windivert_installer = WinDivertInstaller(windivert)
self.execute(windivert_installer.uninstall, [],
msg="Running WinDivert uninstall task")
def initialize_options(self):
pass
def finalize_options(self):
pass
class RunTests(Command):
description = 'Runs the test suite for pydivert'
user_options = []
extra_env = {}
extra_args = []
def run(self):
from pydivert.tests import run_test_suites
for env_name, env_value in self.extra_env.items():
os.environ[env_name] = str(env_value)
with cd(os.path.join(os.path.join(workdir, "pydivert", "tests"))):
run_test_suites()
def initialize_options(self):
pass
def finalize_options(self):
pass
options = dict(name='pydivert',
version='0.0.7',
description='Python binding to windivert driver',
# long_description=readme.read(),
author='Fabio Falcinelli',
author_email='[email protected]',
url='https://github.com/ffalcinelli/pydivert',
download_url='https://github.com/ffalcinelli/pydivert/tarball/%(version)s',
keywords=['windivert', 'network', 'tcp/ip'],
license="LICENSE",
packages=find_packages(),
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Environment :: Win32 (MS Windows)',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Telecommunications Industry',
'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)',
'Operating System :: Microsoft :: Windows :: Windows Vista',
'Operating System :: Microsoft :: Windows :: Windows Server 2008',
'Operating System :: Microsoft :: Windows :: Windows 7',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Networking :: Firewalls',
'Topic :: System :: Networking :: Monitoring',
'Topic :: Utilities',
],
extras_require={
"testing": ["mock>=1.0.1"]
},
cmdclass={
"install": install,
"wd_uninstall": UninstallDriver,
"wd_install": InstallDriver,
"test": RunTests
}, )
options["download_url"] = options["download_url"] % options
setup(**options)